用PHP的Django / mod_wsgi的WAMP [英] Django/mod_wsgi WAMP with PHP

查看:272
本文介绍了用PHP的Django / mod_wsgi的WAMP的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我也跟着<一个href=\"http://stackoverflow.com/questions/11602653/installing-mod-wsgi-on-wamp-server-running-on-windows-7/11602894?noredirect=1#comment30631187_11602894\">this引导并设法使Python与Django的安装工作完美,但它似乎已经呈现所有本地托管的PHP的网站无法访问返回404错误。

I followed this guide and managed to make Python with a Django installation work perfectly, but it seems to have rendered all the locally hosted PHP sites inaccessible returning a 404 error.

的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所。

PHP only renders when I comment out the lastline from httpd.conf.

推荐答案

您需要有,如果你要设置的DocumentRoot 另一个虚拟主机:

You need to have another virtual host if you're going to set the DocumentRoot:

# 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>

另外,因为它是现在,所有的本地请求被发送到蟒蛇沙箱。

Otherwise, as it is now, all the local requests are being sent to the python sandbox.

请注意,你需要有多个主机本地指指点点。

Note that you'll need to have several hosts pointing locally.

这篇关于用PHP的Django / mod_wsgi的WAMP的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆