关于urlpatterns报错的问题求教

我在urls.py里面导入了login这个自己写的app,但报错了,请大家看看是什么原因? Django == 3.1.2

urls.py:

urlpatterns = [ path('admin/', admin.site.urls), path(r'login/', include('login.urls')), ]

错误信息如下: Exception in thread django-main-thread: Traceback (most recent call last): File "D:\Python37\lib\threading.py", line 917, in _bootstrap_inner self.run() File "D:\Python37\lib\threading.py", line 865, in run self._target(*self._args, self._kwargs) File "D:\Python37\lib\site-packages\django\utils\autoreload.py", line 53, in wrapper fn(*args, kwargs) File "D:\Python37\lib\site-packages\django\core\management\commands\runserver.py", line 118, in inner_run self.check(display_num_errors=True) File "D:\Python37\lib\site-packages\django\core\management\base.py", line 442, in check raise SystemCheckError(msg) django.core.management.base.SystemCheckError: SystemCheckError: System check identified some issues:

ERRORS: ?: (urls.E004) Your URL pattern '' is invalid. Ensure that urlpatterns is a list of path() and/or re_path() instances. HINT: Try removing the string ''. The list of urlpatterns should not have a prefix string as the first element.

System check identified 1 issue (0 silenced).

评论 1