所以,我正在尝试在我的专用服务器上运行Django网站,该服务器本身有多个站点,其文件夹结构如下所示:
home/user/www/
site1/
site2/
site3/
mydjangosite.com/
site1,site2等是php / html网站,当然我需要让它们继续运行,所以我想知道我应该如何配置我的httpd.conf,因为下面这些行不起作用:
<VirtualHost *:80>
DocumentRoot home/user/www/mydjangosite.com
ServerName mydjangosite
WSGIScriptAlias / home/user/www/mydjangosite.com/testing/wsgi.py
<Directory "home/user/www/mydjangosite.com/testing">
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
修改
我已经修改了我的httpd.conf而不是上面的行(使用VirtualHost *:80)我接下来添加了:
WSGIScriptAlias / /home/user/www/mydjangosite.com/testing/wsgi.py
WSGIPythonPath /home/user/www/mydjangosite.com
<Directory /home/user/www/mydjangosite.com/testing>
<Files wsgi.py>
Order deny,allow
Allow from all
</Files>
</Directory>
最后我得到了Django的成功页面:
It worked!
Congratulations on your first Django-powered page.
但现在我为我服务器上的每个域都获得了Django页面。
答案 0 :(得分:1)
试试这个:
<VirtualHost *:80>
DocumentRoot /home/user/www/mydjangosite.com
ServerName mydjangosite
WSGIScriptAlias / /home/user/www/mydjangosite.com/testing/wsgi.py
<Directory "/home/user/www/mydjangosite.com/testing">
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
而不是:
<VirtualHost *:80>
DocumentRoot home/user/www/mydjangosite.com
ServerName mydjangosite
WSGIScriptAlias / home/user/www/mydjangosite.com/testing/wsgi.py
<Directory "home/user/www/mydjangosite.com/testing">
Order allow,deny
Allow from all
</Directory>
</VirtualHost>