找不到Django页面错误

时间:2018-08-01 13:07:07

标签: django

您好,我正在尝试解决不断发生的错误;

我当前在mysite / urls.py上的代码是

from django.contrib import admin
from django.urls import path
from django.conf.urls import url
from polls import views

admin.autodiscover()
urlpatterns = [
                   url(r'^polls/$', views.index, name='index'),
                   url(r'^polls/(?P<question_id>\d+)/$', views.detail, name='detail'),
                   url(r'^polls/(?P<question_id>\d+)/vote/$', views.vote, name='vote'),
                   url(r'^polls/(?P<question_id>\d+)/results/$', views.results, name='results'),
                   url('admin/', admin.site.urls),
                   ]

当我尝试访问:8001 / polls时出现错误

Page not found (404)
Request Method: GET
Request URL:    http://127.0.0.1:8001/
Using the URLconf defined in mysite.urls,
Django tried these URL  patterns, in this order:
    ^polls/$ [name='index']
    ^polls/(?P<question_id>\d+)/$ [name='detail']
    ^polls/(?P<question_id>\d+)/vote/$ [name='vote']
    ^polls/(?P<question_id>\d+)/results/$ [name='results']
    admin/
The empty path didn't match any of these.

请帮助我解决导致我无法访问该网站的错误。

0 个答案:

没有答案