Reputation: 657
I am trying to get a django project to work with uswgi and a virtualenv
I am confused about the location of some of the parameters and the output of the daemon
So far this is my configuration
**[uwsgi]
socket=172.26.1.87:8000
chdir=/home/bischofs/1065/1065-Calculation-Tool/TestSite/
module=TestSite.wsgi:application
master=True
pidfile=/tmp/project-master.pid
vacuum=True
max-requests=5000
#daemonize=/var/log/uwsgi/TestSite.log
virtualenv=/home/bischofs/1065/python3.4/% **
My question is when I load it I get
Python version: 2.7.8 (default, Oct 20 2014, 15:08:52) [GCC 4.9.1]
Set PythonHome to /home/bischofs/1065/python3.4/
*** Python threads support is disabled. You can enable it with -- enable-threads ***
Python main interpreter initialized at 0xfcd820
your server socket listen backlog is limited to 100 connections
your mercy for graceful operations on workers is 60 seconds
Even though I am running python3.4 in the virtualenv, Why is not picking up on the correct interpreter and libraries?
I am also getting
*** Operational MODE: single process ***
ImportError: No module named TestSite.wsgi
Even though I have a correct generated wsgi.py file with
import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "TestSite.settings")
from django.core.wsgi import get_wsgi_application
application = get_wsgi_application()
which makes me think I pointed the ini file to the wrong directory.
The uswgi docs are not clear which directories should be pointed to. It just says /path/to/your/project. Does this mean the directory with the settings.py file? or the directory above it?
Upvotes: 0
Views: 725
Reputation: 12953
uWSGI is a binary application linking to a specific python library (like apache+mod_wsgi). Running it in a virtualenv only changes its view of python modules, not the python library it is linked with. As you are using the ubuntu package you only need to install the plugin for python 3 (and load it with plugin = python3). Otherwise activate your virtualenv and pip install uwsgi to have a monolithic version linked with the virtualenv specific python library.
Upvotes: 1
Reputation: 3651
I had used this configuration - everything was fine.
[uwsgi]
chdir=/var/www/prj_name
home=/home/uwsgi/.virtualenvs/prj_name/
pythonpath=/var/www/prj_name
env=DJANGO_SETTINGS_MODULE=prj_name.settings
module=prj_name.wsgi:application
socket=127.0.0.1:3001
master=True
vacuum=True
max-requests=5000
threads = 20
enable-threads = True
buffer-size = 8192
logger = file:/var/logs/prj_name/uwsgi.log
By the way, take a look on virtualenvwrapper and gunicorn. This packages can help you in everyday development a lot.
Upvotes: 0