#1 跪求大神指点:python+django项目运行时出现的错误
当运行:
F:\django\myblog>python manage.py runserver
时;出现以下错误:
Performing system checks…
Unhandled exception in thread started by
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 ‘
Performing system checks…
Unhandled exception in thread started by
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 ‘
项目路由下不能关联子应用的路由:
主路由代码如下:
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'))
项目又可以正常启动。
总之就是不能在主路由下设置新的路由绑定。