简体   繁体   中英

Internal 500 error with Django: trying to set up mod_wsgi

I created a website using django and am trying to set up mod_wsgi with my apache server.

When I go to my website I get this error:

Internal Server Error

The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator, root@localhost and inform them of the time the error occurred, and anything you might have done that may have caused the error.

More information about this error may be available in the server error log.

This is the error log file I get when I try setting up mod_wsgi:

[Wed Jan 07 16:08:01 2015] [error] [client 108.200.246.4] mod_wsgi (pid=18513): Target WSGI script '/var/www/firstweb/firstweb/wsgi.py' cannot be loaded as Python module.
[Wed Jan 07 16:08:01 2015] [error] [client 108.200.246.4] mod_wsgi (pid=18513): Exception occurred processing WSGI script '/var/www/firstweb/firstweb/wsgi.py'.
[Wed Jan 07 16:08:01 2015] [error] [client 108.200.246.4] Traceback (most recent call last):
[Wed Jan 07 16:08:01 2015] [error] [client 108.200.246.4]   File "/var/www/firstweb/firstweb/wsgi.py", line 13, in <module>
[Wed Jan 07 16:08:01 2015] [error] [client 108.200.246.4]     from django.core.wsgi import get_wsgi_application
[Wed Jan 07 16:08:01 2015] [error] [client 108.200.246.4] ImportError: No module named django.core.wsgi

Below is my httpd.conf file:

WSGIScriptAlias /mahi/ /var/www/firstweb/firstweb/wsgi.py
WSGIPythonPath /var/www/firstweb/ 

<Directory "/var/www/firstweb/firstweb">
<Files wsgi.py>
    Order allow,deny
    Allow from all
</Files>

</Directory>

Please help me. I have no direction on where to go.

It seems that the python path is incomplete. In ubuntu is something like this if you use the global Python installation.

WSGIPythonPath /var/www/firstweb/:/usr/local/lib/python3.4/dist-packages

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM