Mattia Mattia - 10 months ago 144
Apache Configuration Question

Apache Django app: ImportError: No module named django.core.wsgi

I installed mod_wsgi, and loaded it in apache.
This is my apache virtual host:

<VirtualHost *:80>
ServerName mysite.localhost
ServerAlias mysite.localhost

Alias /static /var/www/mysite/static
<Directory /var/www/mysite/static>
Require all granted
</Directory>

<Directory /var/www/mysite/mysite>
<Files wsgi.py>
Require all granted
</Files>
</Directory>

WSGIDaemonProcess mysite
WSGIProcessGroup mysite
WSGIScriptAlias / /var/www/mysite/mysite/wsgi.py
</VirtualHost>


When I go to mysite.localhost I get:


ImportError: No module named django.core.wsgi


I try to run it from python shell and everything goes well.
I have django installed globally, not just in the virtualenv.

Thanks.

Answer Source

If you are using Apache with Python 3 on Ubuntu, you should install libapache2-mod-wsgi-py3 instead of libapache2-mod-wsgi.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download