我是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.
这是我的urls.py
urlpatterns = [
path('admin/', admin.site.urls),
url(r'^aggregator/', include('aggregator.urls')),
url(r'^bouncer/', include('bouncer.urls')),
]
我在这里缺少什么?
您在urlpatterns
中缺少通往主目录的路径urlpatterns = [
path('admin/', admin.site.urls),
url(r'^aggregator/', include('aggregator.urls')),
url(r'^bouncer/', include('bouncer.urls')),
url(r'^$', views.yourhomeview),
]