I recently upgraded the uWSGI instance on my server from v0.9.5 to v0.9.6 and ran into a small glitch in the process.
After compiling uWSGI and recompiling nginx, the process seemed work as expected. I fired up Django and hit homepage. Then, I refreshed a few times and got this error message “uWSGI wsgi application not found.”
At first I thought this was odd because the initial request worked but it was the successive requests beyond the number of processes that caused the issue.
Here is the django_wsgi.py script I was using to launch the WSGI instance:
import uwsgi
import sys
import os# insert the parent path to ensure settings file is loaded
sys.path.insert(0, os.path.join(os.path.abspath(os.path.dirname(__file__)), '../'))
os.environ['DJANGO_SETTINGS_MODULE'] = '%s.settings' % os.path.abspath(os.path.dirname(__file__)).split('/')[-1]import django.core.handlers.wsgi
application = django.core.handlers.wsgi.WSGIHandler()
uwsgi.applications = { '/' : application }
Turns out, the changes made in version 0.9.6 modified the way the uWSGI Applications Dict root is handled. The fix is to change the path ‘/’ to an empty string ‘’. The Applications Dict is present to allow for multiple applications to exist per uWSGI process.
Here is the script with the fix:
import uwsgi
import sys
import os# insert the parent path to ensure settings file is loaded
sys.path.insert(0, os.path.join(os.path.abspath(os.path.dirname(__file__)), '../'))
os.environ['DJANGO_SETTINGS_MODULE'] = '%s.settings' % os.path.abspath(os.path.dirname(__file__)).split('/')[-1]import django.core.handlers.wsgi
application = django.core.handlers.wsgi.WSGIHandler()
uwsgi.applications = { '' : application }

