53
I have solved this
in my original command line did not include full path to the wsgi.py file to run uWSGI
uwsgi --http :8000 --chdir /srv/www/databankinfo.com/projectdatabank/ --wsgi-file wsgi.py
to this
uwsgi --http :8000 --chdir /srv/www/databankinfo.com/projectdatabank/ --wsgi-file full/path/wsgi.py
and it worked
50
For others debugging this same error, there is another possibility: an exception is being thrown by your uwsgi.py
. To test this, open a django shell in your app directly with python manage.py shell
and import your uwsgi.py
(use the same path as in your uwsgi.ini
).
- [Django]-Django package to generate random alphanumeric string
- [Django]-Enforce unique upload file names using django?
- [Django]-Django: Get model from string?
14
Check out my blog post on deploying Django behind uwsgi http://blog.johannesklug.de/2012/11/27/deploying-django-behind-nginx-with-uwsgi-and-virtualenv/. I created an ini-File to setup uwsgi, which points to the app callable with the parameter module=project.wsgi:application
.
The whole file reads something like this:
(env)[project@host ~]$ cat uwsgi.ini
[uwsgi]
# path to where you put your project code
chdir=/home/project/project
# python path to the wsgi module, check if you have one
module=project.wsgi:application
# this switch tells uwsgi to spawn a master process,
# that will dynamically spawn new child processes for
# server requests
master=True
# uwsgi stores the pid of your master process here
pidfile=/home/project/master.pid
vacuum=True
# path to your virtual environment
home=/home/project/env/
# path to log file
daemonize=/home/project/log
# this is where you need to point nginx to,
# if you chose to put this in project home make
# sure the home dir is readable and executable by
# nginx
socket=/tmp/uwsgi.sock
### SEE UPDATE NOTICE FOR THIS ONE
env = DJANGO_SETTINGS_MODULE=project.settings
Please note that Iโm using virtualenv.
You might also be missing the lines
import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "project.settings")
in your wsgi.py
- [Django]-Best practice for Django project working directory structure
- [Django]-Can you migrate backwards to before the first migration in South?
- [Django]-Storing an Integer Array in a Django Database
0
Check if u deleted any init.py file from the Djano apps. As django uses them to know which folders are apps, so they are kind of important.
- [Django]-Remove default apps from Django-admin
- [Django]-How can I iterate over ManyToManyField?
- [Django]-How can I get MINIO access and secret key?
0
I got this error because my /etc/uwsgi/vassals/ ini file for the site I was running had the word โmoduleโ misspelled as โmodeuleโ. Check that file carefully if you see htis ereror.
- [Django]-Alowing 'fuzzy' translations in django pages?
- [Django]-How to access the local Django webserver from outside world
- [Django]-CSRF Failed: CSRF token missing or incorrect
0
In uwsgi.ini
Make sure you have set the right module
.
[uwsgi]
module = yourapp.wsgi:application
...
- [Django]-Coverage.py warning: No data was collected. (no-data-collected)
- [Django]-Custom validation in Django admin
- [Django]-How to set current user to user field in Django Rest Framework?