在Django上找不到页面 - 空路



我正在尝试运行此库。我在桌面上下载并复制了它,然后尝试使用以下方式运行它:

py -3.7 manage.py runserver

我得到了:

Starting development server at http://127.0.0.1:8000/
Quit the server with CTRL-BREAK.

但是当我去那个URL时,我会继续遇到此错误:

Page not found (404)
Request Method: GET
Request URL:    http://127.0.0.1:8000/
Using the URLconf defined in django_google_authenticator.urls, Django tried these URL patterns, in this order:
^admin/login/$
^admin/
The empty path didn't match any of these.

我不明白怎么了,有人可以帮我吗?预先感谢!

我认为那是django的正常行为,因为您可以看到您的路径与任何配置的路径不匹配,例如Admin,所以您为什么不尝试http://127.0.0.1:8000/admin/访问Django Admin登录页面。

如果您想看到与404不同的基本URL不同的东西,则需要配置URL并添加重定向视图,以这种方式,当使用基本URL时,它将重定向到您的管理员或其他优先页面。

最新更新