python - django无法运行manage.py runserver如何解决?
问题描述
我正在尝试运行 manage.py 服务器,但它遇到了一些错误!我只是想在网络上打印你好,但它不起作用
(venv) ubuntu@node:~/PycharmProjects/Oin$ python manage.py runserver
Performing system checks...
Unhandled exception in thread started by <function check_errors.<locals>.wrapper at 0x7fd985430158>
Traceback (most recent call last):
File "/home/ubuntu/PycharmProjects/Oin/venv/lib/python3.4/site-packages/django/urls/resolvers.py", line 542, 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 "/home/ubuntu/PycharmProjects/Oin/venv/lib/python3.4/site-packages/django/utils/autoreload.py", line 225, in wrapper
fn(*args, **kwargs)
File "/home/ubuntu/PycharmProjects/Oin/venv/lib/python3.4/site-packages/django/core/management/commands/runserver.py", line 120, in inner_run
self.check(display_num_errors=True)
File "/home/ubuntu/PycharmProjects/Oin/venv/lib/python3.4/site-packages/django/core/management/base.py", line 364, in check
include_deployment_checks=include_deployment_checks,
File "/home/ubuntu/PycharmProjects/Oin/venv/lib/python3.4/site-packages/django/core/management/base.py", line 351, in _run_checks
return checks.run_checks(**kwargs)
File "/home/ubuntu/PycharmProjects/Oin/venv/lib/python3.4/site-packages/django/core/checks/registry.py", line 73, in run_checks
new_errors = check(app_configs=app_configs)
File "/home/ubuntu/PycharmProjects/Oin/venv/lib/python3.4/site-packages/django/core/checks/urls.py", line 13, in check_url_config
return check_resolver(resolver)
File "/home/ubuntu/PycharmProjects/Oin/venv/lib/python3.4/site-packages/django/core/checks/urls.py", line 23, in check_resolver
return check_method()
File "/home/ubuntu/PycharmProjects/Oin/venv/lib/python3.4/site-packages/django/urls/resolvers.py", line 400, in check
warnings.extend(check_resolver(pattern))
File "/home/ubuntu/PycharmProjects/Oin/venv/lib/python3.4/site-packages/django/core/checks/urls.py", line 23, in check_resolver
return check_method()
File "/home/ubuntu/PycharmProjects/Oin/venv/lib/python3.4/site-packages/django/urls/resolvers.py", line 399, in check
for pattern in self.url_patterns:
File "/home/ubuntu/PycharmProjects/Oin/venv/lib/python3.4/site-packages/django/utils/functional.py", line 36, in __get__
res = instance.__dict__[self.name] = self.func(instance)
File "/home/ubuntu/PycharmProjects/Oin/venv/lib/python3.4/site-packages/django/urls/resolvers.py", line 549, in url_patterns
raise ImproperlyConfigured(msg.format(name=self.urlconf_name))
django.core.exceptions.ImproperlyConfigured: The included URLconf '<module 'openin.urls' from '/home/ubuntu/PycharmProjects/Oin/openin/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.
如果您想要任何 .py 文件,请随时询问,谢谢!我的项目目录:https ://github.com/shreekantbatale2/Oinn
解决方案
在您的仓库中进行
以下更改:
在 openin/urls.py 文件中:
您拼写错误urlpatterns
(您将 urlPatterns 编码)
在文件 Oin/urls.py
path('^$', include('openin.urls')),
中
path('', include('openin.urls')),
推荐阅读
- basic-authentication - Callrail - 在 URL 参数下生成 user_token 代码
- python - 如何优化多列的条件累积
- fltk - FLTK 窗口的圆角
- python - 在 Pycaret 中选择要规范化的特定列
- c# - 在 C# 中为电子邮件模板实现对象匹配
- python - mypy:“Optional[Mapping[Any, Any]]”类型的值不可索引
- r - 将矩阵中的多个列值求和并折叠成具有更少列的新矩阵(使用 R)
- c++ - 模板类构造函数中的 static_assert
- python-3.x - 尝试在 jupyter notebook 中使用 pip3 安装 pandas 包时收到错误消息
- powershell - Try-Catch 在通过 powershell 调用 exe 时不起作用