The empty path didn't match any of these.

PyCharm出现如下错误:

 

Page not found (404)

Request Method:GET
Request URL:http://127.0.0.1:8000/

Using the URLconf defined in untitled4.urls, Django tried these URL patterns, in this order:

  1. Chamico/
  2. admin/

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.

 

原因:

       这是我学习Django2.1按照Django官网上的方式来弄的,还是出错,百思不得其解。后来看了大量的博客,发现是path()的问题,path()参数第一个是路径,官网上面让你直接运行 http://127.0.0.1:8000/polls,说的很明白,但是在pycharm上面打开的是http://127.0.0.1:8000  ,所以会出现这样的错误。

解决方法:

        1,手动在浏览器的url后面添加 Chamico(针对我的这个代码)

        2,或者将对应路径中,path函数中第一个参数置为空字符。

 

                                   

 

  • 19
    点赞
  • 21
    收藏
    觉得还不错? 一键收藏
  • 14
    评论
评论 14
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值