I'm currently running Apache 2.2 on Windows and I can get the hello
world of modwsgi to run. However, when I configure my Django project,
Apache has the following errors from the error.log file:
mod_wsgi (pid=5956): Target WSGI script 'C:/django_proj/mysite/apache/
mysite.wsgi' cannot be loaded as Python module.
[Tue Apr 14 21:59:21 2009] [error] [client 127.0.0.1] mod_wsgi
(pid=5956): Exception occurred processing WSGI script 'C:/django_proj/
mysite/apache/mysite.wsgi'.
[Tue Apr 14 21:59:21 2009] [error] [client 127.0.0.1] Traceback (most
recent call last):
[Tue Apr 14 21:59:21 2009] [error] [client 127.0.0.1] File "C:/
django_proj/mysite/apache/mysite.wsgi", line 7, in <module>
[Tue Apr 14 21:59:21 2009] [error] [client 127.0.0.1] import
django.core.handlers.wsgi
[Tue Apr 14 21:59:21 2009] [error] [client 127.0.0.1] File "C:\
\Python26\\lib\\site-packages\\django\\core\\handlers\\wsgi.py", line
8, in <module>
[Tue Apr 14 21:59:21 2009] [error] [client 127.0.0.1] from django
import http
[Tue Apr 14 21:59:21 2009] [error] [client 127.0.0.1] File "C:\
\Python26\\lib\\site-packages\\django\\http\\__init__.py", line 5, in
<module>
[Tue Apr 14 21:59:21 2009] [error] [client 127.0.0.1] from urllib
import urlencode
[Tue Apr 14 21:59:21 2009] [error] [client 127.0.0.1] File "C:\
\Python26\\lib\\urllib.py", line 26, in <module>
[Tue Apr 14 21:59:21 2009] [error] [client 127.0.0.1] import
socket
[Tue Apr 14 21:59:21 2009] [error] [client 127.0.0.1] File "C:\
\Python26\\lib\\socket.py", line 46, in <module>
[Tue Apr 14 21:59:21 2009] [error] [client 127.0.0.1] import
_socket
[Tue Apr 14 21:59:21 2009] [error] [client 127.0.0.1] ImportError: DLL
load failed: The specified module could not be found.
[Tue Apr 14 21:59:24 2009] [error] [client 127.0.0.1] mod_wsgi
(pid=5956): Target WSGI script 'C:/django_proj/mysite/apache/
mysite.wsgi' cannot be loaded as Python module.
[Tue Apr 14 21:59:24 2009] [error] [client 127.0.0.1] mod_wsgi
(pid=5956): Exception occurred processing WSGI script 'C:/django_proj/
mysite/apache/myite.wsgi'.
[Tue Apr 14 21:59:24 2009] [error] [client 127.0.0.1] Traceback (most
recent call last):
[Tue Apr 14 21:59:24 2009] [error] [client 127.0.0.1] File "C:/
django_proj/mysite/apache/mysite.wsgi", line 7, in <module>
[Tue Apr 14 21:59:24 2009] [error] [client 127.0.0.1] import
django.core.handlers.wsgi
[Tue Apr 14 21:59:24 2009] [error] [client 127.0.0.1] File "C:\
\Python26\\lib\\site-packages\\django\\core\\handlers\\wsgi.py", line
8, in <module>
[Tue Apr 14 21:59:24 2009] [error] [client 127.0.0.1] from django
import http
[Tue Apr 14 21:59:24 2009] [error] [client 127.0.0.1] File "C:\
\Python26\\lib\\site-packages\\django\\http\\__init__.py", line 5, in
<module>
[Tue Apr 14 21:59:24 2009] [error] [client 127.0.0.1] from urllib
import urlencode
[Tue Apr 14 21:59:24 2009] [error] [client 127.0.0.1] File "C:\
\Python26\\lib\\urllib.py", line 26, in <module>
[Tue Apr 14 21:59:24 2009] [error] [client 127.0.0.1] import
socket
[Tue Apr 14 21:59:24 2009] [error] [client 127.0.0.1] File "C:\
\Python26\\lib\\socket.py", line 46, in <module>
[Tue Apr 14 21:59:24 2009] [error] [client 127.0.0.1] import
_socket
[Tue Apr 14 21:59:24 2009] [error] [client 127.0.0.1] ImportError: DLL
load failed: The specified module could not be found.
My 'C:/django_proj/mysite/apache/mysite.wsgi' is the following:
import os, sys
sys.path.append('C:/django_proj')
sys.path.append('C:/django_proj/mysite')
os.environ['DJANGO_SETTINGS_MODULE'] = 'mysite.settings'
import django.core.handlers.wsgi
application = django.core.handlers.wsgi.WSGIHandler()
The apache conf is:
Alias /media/ "C:/django_proj/mysite/media/"
<Directory "C:/django_proj/mysite/media">
Order allow,deny
Options Indexes
Allow from all
IndexOptions FancyIndexing
</Directory>
WSGIScriptAlias /blah "C:/django_proj/mysite/apache/mysite.wsgi"
<Directory "C:/django_proj/mysite/apache">
Order allow,deny
Allow from all
</Directory>
I'm trying to run the above locally by accessing:
http://localhost/blah,
I get the 500 Internal Server Error. Can anyone tell me what I'm
missing?