Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/django/21.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在django项目中运行我的服务器时发生导入错误_Django - Fatal编程技术网

在django项目中运行我的服务器时发生导入错误

在django项目中运行我的服务器时发生导入错误,django,Django,堆栈跟踪: Unhandled exception in thread started by <function wrapper at 0x7f535a380938> Traceback (most recent call last): File "/home/kamal/.local/lib/python2.7/site-packages/django/utils/autoreload.py", line 226, in wrapper fn(*args, **kwar

堆栈跟踪:

Unhandled exception in thread started by <function wrapper at 0x7f535a380938>
Traceback (most recent call last):
  File "/home/kamal/.local/lib/python2.7/site-packages/django/utils/autoreload.py", line 226, in wrapper
    fn(*args, **kwargs)
  File "/home/kamal/.local/lib/python2.7/site-packages/django/core/management/commands/runserver.py", line 116, in inner_run
    self.check(display_num_errors=True)
  File "/home/kamal/.local/lib/python2.7/site-packages/django/core/management/base.py", line 426, in check
    include_deployment_checks=include_deployment_checks,
  File "/home/kamal/.local/lib/python2.7/site-packages/django/core/checks/registry.py", line 75, in run_checks
    new_errors = check(app_configs=app_configs)
  File "/home/kamal/.local/lib/python2.7/site-packages/django/core/checks/urls.py", line 10, in check_url_config
    return check_resolver(resolver)
  File "/home/kamal/.local/lib/python2.7/site-packages/django/core/checks/urls.py", line 19, in check_resolver
    for pattern in resolver.url_patterns:
  File "/home/kamal/.local/lib/python2.7/site-packages/django/utils/functional.py", line 33, in __get__
    res = instance.__dict__[self.name] = self.func(instance)
  File "/home/kamal/.local/lib/python2.7/site-packages/django/core/urlresolvers.py", line 417, in url_patterns
    patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)
  File "/home/kamal/.local/lib/python2.7/site-packages/django/utils/functional.py", line 33, in __get__
    res = instance.__dict__[self.name] = self.func(instance)
  File "/home/kamal/.local/lib/python2.7/site-packages/django/core/urlresolvers.py", line 410, in urlconf_module
    return import_module(self.urlconf_name)
  File "/usr/lib/python2.7/importlib/__init__.py", line 37, in import_module
    __import__(name)
  File "/home/kamal/Desktop/mywebsite/mywebsite/urls.py", line 17, in <module>
    from django.urls import path
ImportError: No module named urls
由启动的线程中未处理的异常 回溯(最近一次呼叫最后一次): 包装器中的文件“/home/kamal/.local/lib/python2.7/site packages/django/utils/autoreload.py”,第226行 fn(*args,**kwargs) 文件“/home/kamal/.local/lib/python2.7/site packages/django/core/management/commands/runserver.py”,第116行,在内部运行 self.check(display\u num\u errors=True) 文件“/home/kamal/.local/lib/python2.7/site packages/django/core/management/base.py”,第426行,选中 包括部署检查=包括部署检查, 文件“/home/kamal/.local/lib/python2.7/site packages/django/core/checks/registry.py”,第75行,运行检查 新建错误=检查(应用程序配置=应用程序配置) 文件“/home/kamal/.local/lib/python2.7/site packages/django/core/checks/url.py”,第10行,在check\u url\u config中 返回检查\u分解器(分解器) 文件“/home/kamal/.local/lib/python2.7/site packages/django/core/checks/url.py”,第19行,在check\u解析器中 对于resolver.url\u模式中的模式: 文件“/home/kamal/.local/lib/python2.7/site packages/django/utils/functional.py”,第33行,在__ res=instance.\uuuu dict\uuuu[self.name]=self.func(实例) 文件“/home/kamal/.local/lib/python2.7/site packages/django/core/urlresolvers.py”,第417行,url_模式 patterns=getattr(self.urlconf_模块,“urlpatterns”,self.urlconf_模块) 文件“/home/kamal/.local/lib/python2.7/site packages/django/utils/functional.py”,第33行,在__ res=instance.\uuuu dict\uuuu[self.name]=self.func(实例) urlconf_模块中的文件“/home/kamal/.local/lib/python2.7/site packages/django/core/urlresolvers.py”,第410行 返回导入_模块(self.urlconf_名称) 文件“/usr/lib/python2.7/importlib/_init_uuu.py”,第37行,在导入模块中 __导入(名称) 文件“/home/kamal/Desktop/mywebsite/mywebsite/url.py”,第17行,在 从django.url导入路径 ImportError:没有名为URL的模块
您似乎在遵循Django 2.0的文档,但您使用的是Python 2.7,因此您必须使用较旧版本的Django。请确保按照您实际拥有的Django版本的文档进行操作。

尝试格式化您的帖子,并向我们提供有关您尝试的内容以及如何设置项目的更多信息。