在同一个apache服务器上运行django和wordpress

时间:2012-06-08 20:50:57

标签: django wordpress apache

我想运行www.example.com以便由django访问和管理。和,

www.example.com/about或www.example.com/about /...

www.example.com/wordpress或www.example.com/wordpress /...

由wordpress管理。

因此,wordpress管理员将访问www.example.com/wordpress,其生成的页面将位于www.example.com/about /...

我不知道该怎么做。如何在同一个apache服务器上托管这两件事?

这是我当前的wsgi文件,django应用程序可在www.example.com上运行。但是当我访问www.example.com/about/时,它会尝试通过urls.py而找不到任何内容。我怎么把我的wordpress页面放在这里?

LoadModule wsgi_module modules/mod_wsgi.so

WSGIScriptAlias / "C:\Users\Nikunj\Documents\Aptana Studio 3 Workspace\myapp\myapp\wsgi.py"

Alias / "C:\Users\Nikunj\Documents\Aptana Studio 3 Workspace\myapp\myapp\"

<Directory />
Order allow,deny
Allow from all
</Directory>

感谢您的帮助! :)

编辑这是我使用jdi答案的新文件,但它仍然无效:

LoadModule wsgi_module modules/mod_wsgi.so
WSGIScriptAlias / "C:\Users\Nikunj\Documents\Aptana Studio 3 Workspace\myapp\myapp\wsgi.py"

Alias /wordpress/ "C:\wamp\www\wordpress\wp-admin\"
Alias / "C:\Users\Nikunj\Documents\Aptana Studio 3 Workspace\myapp\myapp\"

<Directory "C:/wamp/www/wordpress/wp-admin/">
  AllowOverride All
  Order Deny,Allow
  Allow from all
</Directory>

<Directory />
  Order allow,deny
  Allow from all
</Directory>

2 个答案:

答案 0 :(得分:2)

在您的apache conf中创建多个目录条目:http://httpd.apache.org/docs/2.0/mod/core.html#directory

一个是为wordpress设置的,一个是为django设置的。现在,每一点流量总是转到你的django应用程序。

它可能看起来像这样(只是猜测):

Alias /about/ "C:/path/to/wordpress/"
Alias /wordpress/ "C:/path/to/wordpress/wp-admin/"

Alias / "C:/Users/Nikunj/Documents/Aptana Studio 3 Workspace/myapp/myapp/"

<Directory "C:/path/to/wordpress/">
  AllowOverride All
  Order Deny,Allow
  Allow from all
</Directory>

<Directory />
  Order allow,deny
  Allow from all
</Directory>

答案 1 :(得分:0)

最终答案:

LoadModule wsgi_module modules/mod_wsgi.so
WSGIScriptAlias / "C:/wamp/www/myapp/myapp/wsgi.py"

Alias /about/ "C:/wamp/www/wordpress/"
<Directory "C:/wamp/www/wordpress/">
  AllowOverride All
  Order Deny,Allow
  Allow from all
</Directory>

<Directory "C:/wamp/www/myapp">
  Order deny,allow
  Allow from all
</Directory>

www.example.com&lt; - django

www.example.com/about< - wp

谢谢!