Answer the question
In order to leave comments, you need to log in
Django 1.8 Uwsgi - ImportError: No module named site. I checked the path, indicated. What to do?
uwsgi is installed globally.
I work from a virtual environment named venv I
create to run uwsgi
[uwsgi]
socket = /home/dbag/dbs/dbs.sock
virtualenv = /home/dbag/venv/
chdir = /home/dbag/dbs/mtest
master = True
workers = 8
module = mtest.wsgi:application
plugins = python34, python3
uid = www-data
gid = www-data
chmod-socket = 777
pythonpath = /home/dbag/venv/
pythonpath = /home/dbag/venv/lib/python3. 4
pythonpath = /home/dbag/venv/lib/python3.4/site-packages
run
(venv)[email protected]:~/dbs$ uwsgi --ini /home/dbag/dbs/1.conf
get:
current working directory: /home/dbag/dbs
detected binary path: /usr/local/bin/uwsgi
chdir() to /home/dbag/dbs/mtest
your processes number limit is 1868
your memory page size is 4096 bytes
detected max file descriptor number: 1024
lock engine: pthread robust mutexes
thunder lock: disabled (you can enable it with --thunder-lock)
uwsgi socket 0 bound to UNIX address /home/dbag/dbs/dbs.sock fd 3
Python version: 2.7. 9 (default, Apr 2 2015, 15:37:21) [GCC 4.9.2]
Set PythonHome to /home/dbag/venv/
I see an error.
ImportError: No module named site
Checking library paths:
(venv)[email protected]:~/dbs$ python -c "from distutils.sysconfig import get_python_lib; print (get_python_lib())"
/home/dbag/venv/lib/python3.4/site-packages
And this is the same as what I have written!
Checking django version:
(venv)[email protected]:~/dbs$ python -c "import django; print (django.VERSION);"
(1, 8, 4, 'final', 0)
I don't understand anything. :( The Python version is also confusing: Python version: 2.7.9, despite the fact that if you just run it:
(venv)[email protected]:~/dbs$ python
Python 3.4.3 (default, Mar 26 2015, 22:03: 40)
I tried to recreate the venv environment on ubuntu 15.04
Answer the question
In order to leave comments, you need to log in
I answer myself so that no one else steps on this rake. The main problem is that uwsgi does not understand *.conf config. He needs either *.ini or xml
[dbag]
chdir = /home/dbag/dbs/mtest
virtualenv = /home/dbag/venv/
socket = /home/dbag/dbs/dbs.sock
vacuum=True
max-requests=10000
harakiri=60
daemonize=/home/dbag/dbs/uwsgi.log
master = True
workers = 8
module = mtest.wsgi:application
uid = dbag
gid = dbag
chmod-socket = 600
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question