#1 跪求大神指点:python+django项目运行时出现的错误 当运行: F:\django\myblog>python manage.py runserver 时;出现以下错误:
Performing system checks…
Unhandled exception in thread started by <function check_errors..wrapper at 0x00000202B0F10F28>
Traceback (most recent call last):
File “E:\Users\Administrator\AppData\Local\Programs\Python\Python36\lib\site-packages\django\urls\resolvers.py”, line 535, 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 “E:\Users\Administrator\AppData\Local\Programs\Python\Python36\lib\site-packages\django\utils\autoreload.py”, line 225, in wrapper
fn(*args, **kwargs)File “E:\Users\Administrator\AppData\Local\Programs\Python\Python36\lib\site-packages\django\core\management\commands\runserver.py”, line 117, in inner_run
self.check(display_num_errors=True)File “E:\Users\Administrator\AppData\Local\Programs\Python\Python36\lib\site-packages\django\core\management\base.py”, line 379, in check
include_deployment_checks=include_deployment_checks,File “E:\Users\Administrator\AppData\Local\Programs\Python\Python36\lib\site-packages\django\core\management\base.py”, line 366, in _run_checks
return checks.run_checks(**kwargs)File “E:\Users\Administrator\AppData\Local\Programs\Python\Python36\lib\site-packages\django\core\checks\registry.py”, line 71, in run_checks
new_errors = check(app_configs=app_configs)File “E:\Users\Administrator\AppData\Local\Programs\Python\Python36\lib\site-packages\django\core\checks\urls.py”, line 13, in check_url_config
return check_resolver(resolver)File “E:\Users\Administrator\AppData\Local\Programs\Python\Python36\lib\site-packages\django\core\checks\urls.py”, line 23, in check_resolver
return check_method()File “E:\Users\Administrator\AppData\Local\Programs\Python\Python36\lib\site-packages\django\urls\resolvers.py”, line 397, in check
warnings.extend(check_resolver(pattern))File “E:\Users\Administrator\AppData\Local\Programs\Python\Python36\lib\site-packages\django\core\checks\urls.py”, line 23, in check_resolver
return check_method()File “E:\Users\Administrator\AppData\Local\Programs\Python\Python36\lib\site-packages\django\urls\resolvers.py”, line 396, in check
for pattern in self.url_patterns:File “E:\Users\Administrator\AppData\Local\Programs\Python\Python36\lib\site-packages\django\utils\functional.py”, line 37, in get
res = instance.__dict__[self.name] = self.func(instance)File “E:\Users\Administrator\AppData\Local\Programs\Python\Python36\lib\site-packages\django\urls\resolvers.py”, line 542, in url_patterns
raise ImproperlyConfigured(msg.format(name=self.urlconf_name))django.core.exceptions.ImproperlyConfigured: The included URLconf ‘<module ‘blog.urls’ from ‘F:\django\myblog\blog\urls.py’>’ 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.
Performing system checks…
Unhandled exception in thread started by <function check_errors..wrapper at 0x000002CFDDC50F28>
Traceback (most recent call last):
File “E:\Users\Administrator\AppData\Local\Programs\Python\Python36\lib\site-packages\django\urls\resolvers.py”, line 535, 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 “E:\Users\Administrator\AppData\Local\Programs\Python\Python36\lib\site-packages\django\utils\autoreload.py”, line 225, in wrapper
fn(*args, **kwargs)File “E:\Users\Administrator\AppData\Local\Programs\Python\Python36\lib\site-packages\django\core\management\commands\runserver.py”, line 117, in inner_run
self.check(display_num_errors=True)File “E:\Users\Administrator\AppData\Local\Programs\Python\Python36\lib\site-packages\django\core\management\base.py”, line 379, in check
include_deployment_checks=include_deployment_checks,File “E:\Users\Administrator\AppData\Local\Programs\Python\Python36\lib\site-packages\django\core\management\base.py”, line 366, in _run_checks
return checks.run_checks(**kwargs)File “E:\Users\Administrator\AppData\Local\Programs\Python\Python36\lib\site-packages\django\core\checks\registry.py”, line 71, in run_checks
new_errors = check(app_configs=app_configs)File “E:\Users\Administrator\AppData\Local\Programs\Python\Python36\lib\site-packages\django\core\checks\urls.py”, line 13, in check_url_config
return check_resolver(resolver)File “E:\Users\Administrator\AppData\Local\Programs\Python\Python36\lib\site-packages\django\core\checks\urls.py”, line 23, in check_resolver
return check_method()File “E:\Users\Administrator\AppData\Local\Programs\Python\Python36\lib\site-packages\django\urls\resolvers.py”, line 397, in check
warnings.extend(check_resolver(pattern))File “E:\Users\Administrator\AppData\Local\Programs\Python\Python36\lib\site-packages\django\core\checks\urls.py”, line 23, in check_resolver
return check_method()File “E:\Users\Administrator\AppData\Local\Programs\Python\Python36\lib\site-packages\django\urls\resolvers.py”, line 396, in check
for pattern in self.url_patterns:File “E:\Users\Administrator\AppData\Local\Programs\Python\Python36\lib\site-packages\django\utils\functional.py”, line 37, in get
res = instance.__dict__[self.name] = self.func(instance)File “E:\Users\Administrator\AppData\Local\Programs\Python\Python36\lib\site-packages\django\urls\resolvers.py”, line 542, in url_patterns
raise ImproperlyConfigured(msg.format(name=self.urlconf_name))django.core.exceptions.ImproperlyConfigured: The included URLconf ‘<module ‘blog.urls’ from ‘F:\django\myblog\blog\urls.py’>’ 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.
项目路由下不能关联子应用的路由: 主路由代码如下:
from django.conf.urls import url, include from django.contrib import admin urlpatterns = [ url(r'^admin/', admin.site.urls), url(r'^index/', include('index.urls')) ]但禁掉
url(r'^index/', include('index.urls'))项目又可以正常启动。
总之就是不能在主路由下设置新的路由绑定。