Explore Courses Blog Tutorials Interview Questions
0 votes
in AWS by (12.9k points)

I am trying to publish my site on an Amazon's EC2 Instance, and I keep getting a 500 error. I really dunno why.

//Log Files

    [Sun Feb 17 23:12:48.066802 2013] mod_wsgi (pid=2102): Target WSGI script '/srv/www/app/poka/apache/' cannot be loaded as Python module.

    [Sun Feb 17 23:12:48.066840 2013] mod_wsgi (pid=2102): Exception occurred processing WSGI script '/srv/www/app/poka/apache/'.

    [Sun Feb 17 23:12:48.066864 2013] Traceback (most recent call last):

    [Sun Feb 17 23:12:48.066889 2013] File "/srv/www/mysite/poka/apache/", line 26, in <module>

    [Sun Feb 17 23:12:48.066920 2013] from django.core.wsgi import get_wsgi_application

    [Sun Feb 17 23:12:48.066945 2013] ImportError: No module named django.core.wsgi

//Apache Config Files

    WSGIScriptAlias / /srv/www/app/mysite/apache/

    WSGIDaemonProcess mysite python-path=/srv/www/app/mysite:/home/ec2-user/.virtualenvs/mysite-main/lib/python2.7/site-packages

    WSGIProcessGroup mysite

    <Directory /srv/www/app/mysite/apache/>


    Order deny,allow

    Allow from all



    <Directory /srv/www/app/mysite/apache/>

    Order deny,allow

    Allow from all


    <Directory /home/ec2-user/app/mysite/static>

    Order deny,allow

    Allow from all


    <Directory /home/ec2-user/app/mysite/media>

    Order deny,allow

    Allow from all



    import os

    import sys

    import site


    os.environ.setdefault("DJANGO_SETTINGS_MODULE", "mysite.settings")

    from django.core.wsgi import get_wsgi_application

    application = get_wsgi_application()

    path = '/srv/www/app/mysite'

    if path not in sys.path:


1 Answer

0 votes
by (18.2k points)

There might be a few packages of the site-packages missing from your virtualenv , when is executed.

This issue can be fixed by modifying the sys.path in your path/project/project/ file.

Just append the project dir along with your virtualenv site-packages to the sys.path List.

If you want to learn more about this AWS service then you should read AWS EC2.

ImportError: No module named django.core.wsgi Apache + VirtualEnv + AWS + WSGI
by (100 points)
Hello Akanksha,

I'm getting the same error.

I have a virtual env setup and when check the log which has the same as the above question.

using pip I've installed all the dependencies but still error not fixed.

Related questions

Want to get 50% Hike on your Salary?

Learn how we helped 50,000+ professionals like you !

0 votes
1 answer
0 votes
1 answer

Browse Categories