Python 如何修复以下有关获取url的错误

Python 如何修复以下有关获取url的错误,python,django,Python,Django,我无法访问(获取)程序中提到的URL url.py from django.conf.urls import include, url from rest_framework import routers from imgstore.views import QueryImage from imgstore.views import ImageActionViewSet # this is DRF router for REST API viewsets router = routers

我无法访问(获取)程序中提到的URL

url.py

from django.conf.urls import include, url
from rest_framework import routers

from imgstore.views import QueryImage
from imgstore.views import ImageActionViewSet


# this is DRF router for REST API viewsets

router = routers.DefaultRouter()

router.register(r'api/v1/imgaction', ImageActionViewSet, r"imgaction")
router.register(r'api/v1/queryimage', QueryImage, r"queryimage")


urlpatterns = [
    url(r'', include(router.urls, namespace='imgaction')),
    url(r'', include(router.urls, namespace='queryimage'))
]
我收到这个错误:

Error occured while running server:
Exception in thread django-main-thread:
Traceback (most recent call last):
File "/root/.pyenv/versions/3.5.7/lib/python3.5/site-packages/django/urls/resolvers.py", line 581, in url_patterns      iter(patterns)TypeError: 'module' object is not iterable
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/root/.pyenv/versions/3.5.7/lib/python3.5/threading.py", line 914, in _bootstrap_innerself.run()
File "/root/.pyenv/versions/3.5.7/lib/python3.5/threading.py", line 862, in runself._target(*self._args, **self._kwargs)
File "/root/.pyenv/versions/3.5.7/lib/python3.5/site-packages/django/utils/autoreload.py", line 54, in wrapperfn(*args, **kwargs)
File "/root/.pyenv/versions/3.5.7/lib/python3.5/site-packages/django/core/management/commands/runserver.py", line 117, in inner_runself.check(display_num_errors=True)
File "/root/.pyenv/versions/3.5.7/lib/python3.5/site-packages/django/core/management/base.py", line 390, in check include_deployment_checks=include_deployment_checks,
File "/root/.pyenv/versions/3.5.7/lib/python3.5/site-packages/django/core/management/base.py", line 377, in _run_checksreturn checks.run_checks(**kwargs)
File "/root/.pyenv/versions/3.5.7/lib/python3.5/site-packages/django/core/checks/registry.py", line 72, in run_checksnew_errors = check(app_configs=app_configs)
File "/root/.pyenv/versions/3.5.7/lib/python3.5/site-packages/django/core/checks/urls.py", line 13, in check_url_config return check_resolver(resolver)
File "/root/.pyenv/versions/3.5.7/lib/python3.5/site-packages/django/core/checks/urls.py", line 23, in check_resolverreturn check_method()
File"/root/.pyenv/versions/3.5.7/lib/python3.5/sitepackages/django/urls/resolvers.py", line 398, in checkfor pattern in self.url_patterns:
File "/root/.pyenv/versions/3.5.7/lib/python3.5/site-packages/django/utils/functional.py", line 80, in __get__res = instance.__dict__[self.name] = self.func(instance)
File "/root/.pyenv/versions/3.5.7/lib/python3.5/site-packages/django/urls/resolvers.py", line 588, in url_patterns raise ImproperlyConfigured(msg.format(name=self.urlconf_name))
django.core.exceptions.ImproperlyConfigured: The included URLconf 'image_storage.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.

我不知道该怎么解决。我缺少什么?

检查image\u storage django应用程序中可能存在的文件url.py。它应该包含一个有效的django url配置,并且不能为空

这通常是由于Django的resolvers.py试图使用您的URL.py时出现异常而导致的

我通常的解决方法是将我的整个url.py文件(以及所有其他url.py文件)包装在一个try-except块中,并打印捕获的异常,这通常比Django提供的默认异常更能立即解决问题

祝你好运