I created very simple project, but it shows me Django 404 error page (debug mode is On).
urls.py:
....
urlpatterns = patterns('',
(r'^news/', include('news.urls')),
)
news/urls.py:
....
urlpatterns = patterns('news.views',
(r'^$', 'news'),
)
I also have "news" in INSTALLED_APPS.
When I open
http://localhost/news/
in browser Django shows me 404 error:
" ... Page not found. Request URL: http://localhost/news// ..."
What's wrong with my urls?
您的urls.py说:“在应用news
views.py
文件中调用函数def news(request)
。此功能存在吗?
You have two slash in the end of url. maybe it's answer
Assuming that news is ur app name and news is the view name also. Try this in news/urls.py:
urlpatterns = patterns('',
(r'^$', 'news.views.news'),
)
Your code should work
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.