我在urls.py下面的代碼:Django的URLPATTERN 「不匹配」
urlpatterns = patterns('',
(r'^news/', include('news.urls')),
)
當我嘗試打開
http://localhost/news
或
http://localhost/news/
瀏覽器django給我看404頁面:
Using the URLconf defined in python.urls, Django tried these URL patterns, in this order:
^news/
The current URL, , didn't match any of these.
UPD:
新聞/ urls.py:
from django.conf.urls.defaults import *
from django.views.generic.simple import direct_to_template
urlpatterns = patterns('news.views',
(r'^$', 'news'),
)
有新聞目錄views.py,它包含了新聞的功能。
並將新聞模塊添加到INSTALLED_APPS。
爲什麼找不到新聞模式?有什麼建議麼?
向我們展示你的'news/urls.py'? – greg
'在python.urls中定義的URLconf < - python.urls?真? –
[Django的URL正則表達式引擎失敗]的可能重複(http://stackoverflow.com/questions/18390217/djangos-url-regex-engine-is-failing) –