民意测验应用程序Django教程不工作

2024-04-24 15:11:12 发布

您现在位置:Python中文网/ 问答频道 /正文

我按照the tutorial中的说明操作

我做了一个调试更改,文件如下:

我的网站1\网址.py公司名称:

from django.conf.urls import include, url
from django.contrib import admin


urlpatterns = [
    url(r'^abc/', include('polls.urls')),
    url(r'^polls/', admin.site.urls),
    url(r'^admin/', admin.site.urls),
]

文件:mysite1\polls\网址.py在

^{pr2}$

现在如果我转到站点http://127.0.0.1:8000/polls/,那么它显示的登录页面与转到站点http://127.0.0.1:8000/admin/相同。在

但是,如果我访问站点http://127.0.0.1:8000/abc/,它会给出以下信息:

Page not found (404)
Request Method: GET
Request URL:    http://127.0.0.1:8000/abc
Using the URLconf defined in mysite1.urls, Django tried these URL patterns, in this order:
^abc/
^polls/
^admin/
The current URL, abc, 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.

有人能告诉我我做错了什么吗?在


Tags: 文件thedjangoinfrompyhttpurl