Python 运行服务器后出现django 2.2.3-django 404错误(';找不到页面';)
我的项目名为“tweetme”,当我运行服务器时,会出现此错误Python 运行服务器后出现django 2.2.3-django 404错误(';找不到页面';),python,django,python-3.x,django-2.2,Python,Django,Python 3.x,Django 2.2,我的项目名为“tweetme”,当我运行服务器时,会出现此错误 Using the URLconf defined in tweetme.urls, Django tried these URL patterns, in this order: ^admin/ ^static/(?P<path>.*)$ The empty path didn't match any of these. You're seeing this error becau
Using the URLconf defined in tweetme.urls, Django tried these URL patterns, in this order:
^admin/
^static/(?P<path>.*)$
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.
我希望显示:安装成功!祝贺
但它告诉我:在/上找不到页面您在配置中只定义了两个url模式。因此,只有这些才能像预期的那样成功地工作。要使url/正常工作,您必须在相对url中使用“”或“/”添加Django文档中提到的其他url模式
这个错误有什么让人困惑的地方?您确实还没有为
/
定义URL模式。它不会显示祝贺页面,因为您已经为编辑定义了一个模式,用于/admin.thnx,但是我如何修复它
from django.conf.urls import url, include
from django.contrib import admin
from django.conf import settings
from django.conf.urls.static import static
urlpatterns = [
url(r'^admin/', admin.site.urls),
]
if settings.DEBUG:
urlpatterns += (static(settings.STATIC_URL,
document_root=settings.STATIC_ROOT))