Django虚拟主机设置.Apache mod_wsgi [英] Django virtual host setup. Apache mod_wsgi
问题描述
我希望对我的问题有一个简单的答案,因为我对python和Apache并不是最有经验.
I am hoping there is a simple answer to my question as I am not the most experienced with python and Apache.
我正在尝试使用mod_wsgi连接Apache.我已经使用虚拟主机来做到这一点.见下文:
I am trying to hook up Apache with mod_wsgi. I have used a virtual host to do so. see below:
<VirtualHost *:80>
ServerAdmin admin@example.com
ServerName testserver.com/django
#DocumentRoot /
WSGIScriptAlias / /home/mycode/mysite/scripts/django.wsgi
Alias /media/ /home/mycode/mysite/mysite/media/
Alias /adminmedia/ /opt/python2.7/lib/python2.7/site-packages/django/contrib/admin/media/
<Directory "/home/mycode/mysite/mysite/media">
Order deny,allow
Allow from all
</Directory>
</VirtualHost>
当我去testserver.com而不是我的php索引页面时,这对我的django项目效果很好,我得到了django项目.
This works great for my django project when I go to testserver.com instead of my php index page I get my django project.
我要寻找的是允许我的/var/www/html/中的php项目与django项目共存的帮助.我正在尝试使其达到我的django项目,我输入testserver.com/django
What I am looking for is help with allow my php projects in /var/www/html/ and my django projects to coexist. I am trying to make it so to reach my django project I type testserver.com/django
任何帮助或指导都将不胜感激:)
Any help or guidance is greatly appreciated :)
谢谢!
推荐答案
更改:
WSGIScriptAlias / /home/mycode/mysite/scripts/django.wsgi
收件人:
WSGIScriptAlias /django /home/mycode/mysite/scripts/django.wsgi
第一个参数是挂载点,您必须将其作为Web服务器的根目录,因此只需将其更改为'/django'.
The first argument is the mount point, you have it to be the root of the web server, so just change it to '/django' instead.
这篇关于Django虚拟主机设置.Apache mod_wsgi的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!