是否有可能为一个项目使用两个不同的urls.py文件,一直使用其中的一个,但为了开发的目的而调用第二个项目呢?
我想要的是这样的:
对于生产(并且是24/7现场),我想要以下链接:
www.mydomain.com www.mydomain.com/about/ www.mydomain.com/contact/
但对于开发(我现在使用runserver ,然后testing),我想要所有的基础链接,再加上一些:
www.mydomain.com www.mydomain.com/about/ www.mydomain.com/contact/ www.mydomain.com/secret/sauce/ www.mydomain.com/punchanella/in/the/zoo/ www.mydomain.com/me/too/
所以有效的外部世界甚至不知道我的额外链接存在,因为他们没有任何访问权限。
这甚至有可能吗?
我会这样做
在你的settings.py中设置如下
LOCAL_DEV = True
然后在你的urls.py
from django.conf import settings if settings.LOCAL_DEV: urlpatterns = patterns('', # # all your other urls here for dev # )