【问题标题】:Page not found on Django - Empty paths在 Django 上找不到页面 - 空路径
【发布时间】:2019-07-23 22:40:27
【问题描述】:

我正在尝试运行this library。我将它下载并复制到我的桌面上,然后我尝试使用以下命令运行它:

py -3.7 manage.py runserver

我明白了:

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

但是当我转到那个网址时,我不断收到这个错误:

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.

我不明白出了什么问题,有人可以帮助我吗?提前致谢!

【问题讨论】:

    标签: python django two-factor-authentication


    【解决方案1】:

    我认为这是 Django 的正常行为,正如您所看到的,您的路径与任何配置的路径都不匹配,例如管理员,所以您为什么不尝试 http://127.0.0.1:8000/admin/访问 Django 管理员登录页。

    如果您想看到与 404 不同的基本 url,您需要 configure your urls 并可能添加一个重定向视图,这样当使用基本 url 时,它将重定向到您的管理员或其他首选页面。

    【讨论】:

      猜你喜欢
      • 2020-11-08
      • 2019-02-02
      • 1970-01-01
      • 2017-12-05
      • 2019-06-04
      • 1970-01-01
      • 1970-01-01
      • 2014-11-01
      • 2018-09-12
      相关资源
      最近更新 更多