简体   繁体   English

Django 虚拟主机设置。 Apache mod_wsgi

[英]Django virtual host setup. Apache mod_wsgi

I am hoping there is a simple answer to my question as I am not the most experienced with python and Apache.我希望我的问题有一个简单的答案,因为我对 python 和 Apache 不是最有经验的。

I am trying to hook up Apache with mod_wsgi.我正在尝试将 Apache 与 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>

This works great for my django project when I go to testserver.com instead of my php index page I get my django project.这对我的 django 项目非常有用,当我 go 到 testserver.com 而不是我的 php 索引页时,我得到了我的 django 项目。

What I am looking for is help with allow my php projects in /var/www/html/ and my django projects to coexist.我正在寻找的是帮助我在 /var/www/html/ 中的 php 项目和我的 django 项目共存。 I am trying to make it so to reach my django project I type testserver.com/django我正在努力做到这一点,以便到达我的 django 项目,我输入 testserver.com/django

Any help or guidance is greatly appreciated:)非常感谢任何帮助或指导:)

Thanks!谢谢!

Change:改变:

WSGIScriptAlias / /home/mycode/mysite/scripts/django.wsgi

to:到:

WSGIScriptAlias /django /home/mycode/mysite/scripts/django.wsgi

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.第一个参数是挂载点,你让它成为 web 服务器的根目录,所以只需将它改为 '/django'。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM