看不到Django主页

2024-05-29 04:52:02 发布

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

我是刚到django的,所以问题来了。 我有一个django项目,其中有两个应用程序,两个都运行良好。只是我无法访问主页-这应该是默认的django页面。我得到以下错误

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

admin/
^aggregator/
^bouncer/
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.

这是我的网址.py你知道吗

urlpatterns = [
        path('admin/', admin.site.urls),
        url(r'^aggregator/', include('aggregator.urls')),
        url(r'^bouncer/', include('bouncer.urls')),

    ]

我错过了什么?你知道吗


Tags: path项目djangoinurlincludeadminrequest
1条回答
网友
1楼 · 发布于 2024-05-29 04:52:02

您缺少urlpatterns中主目录的路径

urlpatterns = [
    path('admin/', admin.site.urls),
    url(r'^aggregator/', include('aggregator.urls')),
    url(r'^bouncer/', include('bouncer.urls')),
   url(r'^$', views.yourhomeview),

]

相关问题 更多 >

    热门问题