Django-nonrel + VirtualEnv + uWSGI + Nginx + ImportError: No module named wsgi

If your uWSGI configuration is causing the below error to be displayed in the logs:

from django.core.wsgi import get_wsgi_application>
ImportError: No module named wsgi

Check if you are using Django 1.3 or below. If yes, confirm if the below lines are listed in your wsgi.py file:

from django.core.wsgi import get_wsgi_application
application = get_wsgi_application()

If yes, comment those lines and insert the below ones:

import django.core.handlers.wsgi
application = django.core.handlers.wsgi.WSGIHandler()

Reference:

Advertisements

2 thoughts on “Django-nonrel + VirtualEnv + uWSGI + Nginx + ImportError: No module named wsgi

    1. If first condition (if ‘yes’) is for checking if you are using Django 1.3. The second condition is the scenario if you find the below lines in the wsgi.py file.

      from django.core.wsgi import get_wsgi_application
      application = get_wsgi_application()

      Hope that helps!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s