I wrote an application using Django 1.0. It works fine with the django test server. But when I tried to get it into a more likely production enviroment the Apache server fails to run the app. The server I use is WAMP2.0. I've been a PHP programmer for years now and I've been using WAMPServer since long ago. I installed the mod_wsgi.so and seems to work just fine (no services error) but I can't configure the httpd.conf to look at my python scripts located outside the server root.
For now, I'm cool with overriding the document root and serve the django app from the document root instead so the httpd.conf line should look like this:
WSGIScriptAlias / C:/Users/Marcos/Documents/mysite/apache/django.wsgi
but the server's response is a 403 Forbidden
You have:
WSGIScriptAlias / /C:/Users/Marcos/Documents/mysite/apache/django.wsgi
That is wrong as RHS is not a valid Windows pathname. Use:
WSGIScriptAlias / C:/Users/Marcos/Documents/mysite/apache/django.wsgi
That is, no leading slash before the Windows drive specifier.
Other than that, follow the mod_wsgi documentation others have pointed out.
Poster edited question to change what now would appear to be a typo in the post and not a problem with his configuration.
If that is the case, next causes for a 403 are as follows.
First is that you need to also have:
<Directory C:/Users/Marcos/Documents/mysite/apache>
Order deny,allow
Allow from all
</Directory>
If you don't have that then Apache isn't being granted rights to serve a script from that directory and so will return FORBIDDEN (403).
Second is that you do have that, but don't acknowledge that you do, and that that directory or the WSGI script file is not readable by the user that the Apache service runs as under Windows.
Have you seen http://code.google.com/p/modwsgi/wiki/IntegrationWithDjango ?
You need more than one line to assure that Apache will play nicely.
Alias /media/ /usr/local/django/mysite/media/
<Directory /usr/local/django/mysite/media>
Order deny,allow
Allow from all
</Directory>
WSGIScriptAlias / /usr/local/django/mysite/apache/django.wsgi
<Directory /usr/local/django/mysite/apache>
Order deny,allow
Allow from all
</Directory>
The <Directory>
, as well as appropriate file system ownership and permissions are essential.
The usr/local/django/mysite/apache
directory has your Python/Django app and the all-important django.wsgi
file. You must provide permissions on this directory.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With