0
나는 this guide을 따라 갔고 장고 설치 작업으로 파이썬을 완벽하게 관리 할 수 있었지만 로컬로 호스팅 된 모든 PHP 사이트를 액세스 할 수 없게 만들었습니다. 404 오류를 반환합니다.Django/mod_wsgi WAMP with PHP
을 httpd.conf
LoadModule wsgi_module modules/mod_wsgi.so
#This is placed right after the rule for <Directory "f:/WAMP/www/">
<Directory "f:/WAMP/www/python">
Options ExecCGI
AddHandler wsgi-script .py
Order allow,deny
Allow from all
</Directory>
#This is placed at the end of the file
<IfModule ssl_module>
SSLRandomSeed startup builtin
SSLRandomSeed connect builtin
</IfModule>
Include "f:/WAMP/alias/*"
Include "F:/WAMP/www/python/sandbox/apache/apache_django_wsgi.conf"
apache_django_wsgi.conf
Alias /python/images/ "F:/WAMP/www/python/sandbox/images"
<Directory "F:/WAMP/www/python/sandbox/images">
Order allow,deny
Allow from all
</Directory>
WSGIScriptAlias /python "F:/WAMP/www/python/sandbox/apache/django.wsgi"
<Directory "F:/WAMP/www/python/sandbox/apache">
Allow from all
</Directory>
<VirtualHost *:80>
DocumentRoot f:/WAMP/www/python/sandbox/
ServerName 127.0.0.1
</VirtualHost>
django.wsgi
import os, sys
sys.path.append('F:/WAMP/www/python/sandbox')
os.environ['DJANGO_SETTINGS_MODULE'] = 'sandbox.settings'
import django.core.handlers.wsgi
application = django.core.handlers.wsgi.WSGIHandler()
PHP에 내가 httpd.conf의 lastline을 주석 처리 할 때 렌더링됩니다. 그렇지 않으면
# This is for PHP
<VirtualHost *:80>
DocumentRoot f:/WAMP/www/
ServerName local.php.dev
</VirtualHost>
# This is for your Django stuff
<VirtualHost *:80>
DocumentRoot f:/WAMP/www/python/sandbox/
ServerName local.py.dev
</VirtualHost>
가 지금처럼, 모든 지역의 요청이 파이썬 샌드 박스에 전송되는 : 당신이 DocumentRoot
을 설정하는 거라면
이 줄'DocumentRoot f :/WAMP/www/python/sandbox /'는 모든 것을 그 디렉토리로 보냅니다. PHP를 실행하려면 다른 가상 호스트가 필요하다고 생각합니다. –
나는 python/django 디렉토리에만 특정 규칙을 현지화하는 방법이 있습니까? 여러 개의 가상 호스트를 설정하는 것이 훨씬 효율적이지 않습니다. –
비효율적이지는 않지만 모든 아파치 사이트가 작동하는 방식입니다. 호스트 파일을 편집하고 python.dev 및 php.dev라는 2 개의 사이트를 만들어야합니다. 그런 다음 파이썬 vhost와 php vhost 각각에 대한'ServerName'을 작성하십시오. –