在django 1.11民意调查应用程序中设置视图时出现404错误

时间:2018-06-01 05:55:15

标签: python django

我正在使用 MacOS HighSierra django 1.11 python 2.7.14 。每当我设置视图并运行服务器时,polls / 1都会返回404错误。我正在关注官方的django课程。该页面说明了这一点 -

Page not found (404)
Request Method: GET
Request URL:    http://localhost:8000/polls/1
Using the URLconf defined in mysite.urls, Django tried these URL patterns, in this order:

^polls/ ^$ [name='index']
^polls/ ^(?P<question_id>[0-9]+)/$, [name='detail']
^polls/ ^(?P<question_id>[0-9]+)/results/$, [name='results']
^polls/ ^(?P<question_id>[0-9]+)/vote/$, [name='vote']
^admin/
The current path, polls/1, didn't match any of these.

You're seeing this error because you have DEBUG = True in your Django settings file.
Change that to False, and Django will display a standard 404 page.

0 个答案:

没有答案