Home > django, python > Import Error: No module named django.core.wsgi

Import Error: No module named django.core.wsgi

Problem:
I have an nginx + django + wsgi setup. When I try to bring up the site I was getting the import error.

Solution:
Found a solution on stackoverflow. Turns out that wsgi was not able to find django in my site-packages. Following the pointers in the stackoverflow link below, I updated my sys.path and that fixed the issue.

import os
import sys

sys.path.append("/usr/share/python/<my_project_name>/lib/python2.7/site-packages")
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "<my_project_name>.settings")

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

Source:
http://stackoverflow.com/questions/14927345/importerror-no-module-named-django-core-wsgi-apache-virtualenv-aws-wsgi

Advertisements
  1. No comments yet.
  1. No trackbacks yet.

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

%d bloggers like this: