?: (2_0.W001) Your URL pattern...This was likely an oversight when migrating to django.urls.path().”

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/SilentWu/article/details/88205831

在运行Django过程中,PyCharm的console提示“WARNINGS:
?: (2_0.W001) Your URL pattern '^index' has a route that contains '(?P<', begins with a '^', or ends with a '$'. This was likely an oversight when migrating to django.urls.path().”

原因:从Django2.0以后,urls.py配置不同

解决方案:

  • 把url函数换成path

  • 不适用^,$作路由

eg:

2.0以前版本:

2.0以后版本

猜你喜欢

转载自blog.csdn.net/SilentWu/article/details/88205831
今日推荐