Install Django with mod_wsgi

I wrote an application using Django 1.0. It works great with django test server. But when I tried to turn it into a more likely production environment, the Apache server was unable to start the application. The server I'm using is WAMP2.0 . I have been a PHP programmer for many years, and I have been using WAMPServer for a long time. I installed mod_wsgi.so and it seems to work fine (without service errors), but I cannot configure httpd.conf to view python scripts located outside the server root.

For the time being, it's cool for me to override the document root and instead use the django application from the document root, so the httpd.conf line should look like this:

    WSGIScriptAlias ​​/ C: /Users/Marcos/Documents/mysite/apache/django.wsgi

but server response is 403 Forbidden

+3
source share
3 answers

You have:

WSGIScriptAlias / /C:/Users/Marcos/Documents/mysite/apache/django.wsgi

This is not true because RHS is not a valid Windows name. Using:

WSGIScriptAlias / C:/Users/Marcos/Documents/mysite/apache/django.wsgi

That is, there is no leading slash before the Windows drive qualifier.

Other than that, follow the documentation described by other mod_wsgi developers.


I edited the question from the poster to change what now seems like a typo in the message, and not a problem with its configuration.

If so, the following reasons for 403 are as follows.

Firstly, you also need:

<Directory C:/Users/Marcos/Documents/mysite/apache>
Order deny,allow
Allow from all
</Directory>

If you do not have this, then Apache does not get the right to service the script from this directory and therefore will return FORBIDDEN (403).

-, , , , WSGI script , Apache Windows.

+7

http://code.google.com/p/modwsgi/wiki/IntegrationWithDjango?

, , Apache .

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>

<Directory>, .

usr/local/django/mysite/apache Python/Django django.wsgi. .

+6

Source: https://habr.com/ru/post/1713775/


All Articles