【发布时间】:2020-03-19 17:18:22
【问题描述】:
我是 Django 的初学者,我创建了一个 Django 项目,当我在两个应用程序中添加 urls.py 文件时,我又添加了两个应用程序,两者都运行良好,但是当我获取我的主管理 URL 时,它给出一个错误
Page not found (404)
Request Method: GET
URL: http://127.0.0.1:8000/
the URLconf defined in mac.urls, Django tried these URL patterns, in this order:
admin/
shop/
blog/
The empty path 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.
当我在 http://127.0.0.1:8000/ 中获取此 URL 时,我收到一个错误,它适用于 http://127.0.0.1:8000/shop/
这是我的主要 urls.py
from django.contrib import admin
from django.urls import path, include
urlpatterns = [
path('admin/', admin.site.urls),
path('shop/', include('shop.urls')),
path('blog/', include('blog.urls')),
]
【问题讨论】:
标签: python django url-pattern