Django urls.py捕获WampServer上所有现有HTML项目的URL

时间:2012-09-03 22:08:14

标签: django apache wamp django-urls httpd.conf

我让WampServer与Aptana IDE完美配合,为不同的html项目使用多个文件夹。然后我安装了Django并将其添加到Apache的httpd.conf:

Alias /images/ "c:/wamp/www/daas/templates/images/"
<Directory "c:/wamp/www/daas/images>
Order allow,deny
Allow from all
</Directory>

WSGIScriptAlias / "c:/wamp/www/daas/apache/django.wsgi"

<Directory "c:/wamp/www/daas/apache">
Allow from all
</Directory>

<VirtualHost *:80>
    ServerName 127.0.0.1
    DocumentRoot c:/wamp/www/daas/
</VirtualHost>

现在我用于html项目的虚拟主机......

NameVirtualHost 127.0.0.1
<VirtualHost 127.0.0.1>
    ServerName localhost
    DocumentRoot 'C:\wamp\www'
</VirtualHost>
<VirtualHost 127.0.0.1>
    ServerName projectA.local
    DocumentRoot 'C:\wamp\www\projectA'
</VirtualHost>

无法正确加载,因为Django的urls.py正在捕获所有网址The current URL, projectA, didn't match any of these regular expressions,即使是不在Django项目中的网址。

我该如何解决这个问题?在Djano方面还是在Apache方面?这里(How do i run Django and phpmyadmin on apache webserver on ubuntu)是一个类似的问题,但解决方案对我没有用。幸运的是localhost/phpmyadmin正常工作,但localhost/projectA没有。

1 个答案:

答案 0 :(得分:1)

看起来httpd.conf中的WSGIScriptAlias / "c:/wamp/www/daas/apache/django.wsgi"捕获了对apache的所有请求。