Mattia Mattia - 3 years ago 284
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 /var/www/mysite/mysite>
Require all granted

WSGIDaemonProcess mysite
WSGIProcessGroup mysite
WSGIScriptAlias / /var/www/mysite/mysite/

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.


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