【发布时间】:2015-07-31 10:10:25
【问题描述】:
在我的公司,我们有一台带有公共 IP 和 Wordpres 的服务器。 Wordpress url 类似于 www.companyblog.org 并且工作正常。
但是,我需要在同一服务器上部署 Django 应用程序,网址为:www.companyblog.org/testproject。
我正在使用Ubuntu 12.04 LTS 和Apache 2.2。
这是我的 Django 应用程序的虚拟主机配置:
<VirtualHost *:80>
ServerAdmin webmaster@localhost
ServerName companyblog.org
ServerAlias www.companyblog.org
DocumentRoot /var/www/wordpress/public_html
WSGIScriptAlias /testproject /home/mazix/djangoprojects/testproject/testproject/wsgi.py
<Directory /var/www/wordpress/public_html>
Order allow,deny
allow from all
</Directory>
<Directory /home/mazix/djangoprojects/testproject>
Order allow,deny
Allow from all
</Directory>
ErrorLog /var/log/error.log
LogLevel warn
CustomLog /var/log/access.log combined
</VirtualHost>
还有我遇到的问题……:
- 当在
www.companyblog.org启用 Wordpress 站点启用并且在www.companyblog.org/testproject启用 Django 应用程序站点时,我收到了著名的 Wordpress 错误:This is somewhat embarrassing, isn’t it? It seems we can’t find what you’re looking for. Perhaps searching, or one of the links below, can help. - 当 Wordpress 网站在
www.companyblog.org被禁用 并且 Django 应用网站在www.companyblog.org/testproject启用时,我可以访问测试 Django 网站,所以它工作正常。
我没有更改默认的 Django 应用程序项目。我没有更改 urls.py、wsgi.py 等 - 它们都没有更改。我只将WSGIPythonPath /home/mazix/djangoprojects/testproject 添加到/etc/apache2/apache2.conf 文件中。
【问题讨论】:
-
你有单独的 Apache conf 用于 Wordpress 网站吗?
-
@DanielRoseman:是的,这里是:pastie.org/private/kaece7lmmwenhkumtfesq
标签: python django wordpress mod-wsgi apache2.2