游走的鱼

导航

The included URLconf 'devops.urls' does not appear to have any patterns in it

问题背景:

clone git仓库项目启动django时候报错

/usr/local/python3/lib/python3.6/site-packages/paramiko/transport.py:33: CryptographyDeprecationWarning: Python 3.6 is no longer supported by the Python core team. Therefore, support for it is deprecated in cryptography and will be removed in a future release.
  from cryptography.hazmat.backends import default_backend
Exception in thread django-main-thread:
Traceback (most recent call last):
  File "/usr/local/python3/lib/python3.6/site-packages/django/urls/resolvers.py", line 600, in url_patterns
    iter(patterns)
TypeError: 'module' object is not iterable

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/local/python3/lib/python3.6/threading.py", line 916, in _bootstrap_inner
    self.run()
  File "/usr/local/python3/lib/python3.6/threading.py", line 864, in run
    self._target(*self._args, **self._kwargs)
  File "/usr/local/python3/lib/python3.6/site-packages/django/utils/autoreload.py", line 64, in wrapper
    fn(*args, **kwargs)
  File "/usr/local/python3/lib/python3.6/site-packages/django/core/management/commands/runserver.py", line 118, in inner_run
    self.check(display_num_errors=True)
  File "/usr/local/python3/lib/python3.6/site-packages/django/core/management/base.py", line 423, in check
    databases=databases,
  File "/usr/local/python3/lib/python3.6/site-packages/django/core/checks/registry.py", line 76, in run_checks
    new_errors = check(app_configs=app_configs, databases=databases)
  File "/usr/local/python3/lib/python3.6/site-packages/django/core/checks/urls.py", line 13, in check_url_config
    return check_resolver(resolver)
  File "/usr/local/python3/lib/python3.6/site-packages/django/core/checks/urls.py", line 23, in check_resolver
    return check_method()
  File "/usr/local/python3/lib/python3.6/site-packages/django/urls/resolvers.py", line 412, in check
    for pattern in self.url_patterns:
  File "/usr/local/python3/lib/python3.6/site-packages/django/utils/functional.py", line 48, in __get__
    res = instance.__dict__[self.name] = self.func(instance)
  File "/usr/local/python3/lib/python3.6/site-packages/django/urls/resolvers.py", line 607, in url_patterns
    raise ImproperlyConfigured(msg.format(name=self.urlconf_name)) from e
django.core.exceptions.ImproperlyConfigured: The included URLconf 'devops.urls' does not appear to have any patterns in it. If you see valid patterns in the file then the issue is probably caused by a circular import.

解决方案:

Try using python manage.py makemigrations (Insert your Django app name)

可能是缺少某些依赖包,最好启动之前先将项目中的第三方依赖包安装一下。

posted on 2022-10-12 16:34  游走的鱼  阅读(52)  评论(0编辑  收藏  举报