开发者社区> 问答> 正文

DJango NoModuleFoundError

我在我的Django项目中获得了ModuleNotFoundError,我在类似的文章中做了大量的研究,并做了与项目相关的修改,但是运气不好!无法解决这个错误,所以我发布了这个。 项目结构截图->项目结构 加亮为参考。

Traceback (most recent call last):
  File "manage.py", line 21, in <module>
    main()
  File "manage.py", line 17, in main
    execute_from_command_line(sys.argv)
  File "/Users/prithvi/pyhtonprojects/DjangoProjects/doc_app/venv/lib/python3.7/site-packages/django/core/management/__init__.py", line 381, in execute_from_command_line
    utility.execute()
  File "/Users/prithvi/pyhtonprojects/DjangoProjects/doc_app/venv/lib/python3.7/site-packages/django/core/management/__init__.py", line 375, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/Users/prithvi/pyhtonprojects/DjangoProjects/doc_app/venv/lib/python3.7/site-packages/django/core/management/base.py", line 323, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/Users/prithvi/pyhtonprojects/DjangoProjects/doc_app/venv/lib/python3.7/site-packages/django/core/management/base.py", line 361, in execute
    self.check()
  File "/Users/prithvi/pyhtonprojects/DjangoProjects/doc_app/venv/lib/python3.7/site-packages/django/core/management/base.py", line 390, in check
    include_deployment_checks=include_deployment_checks,
  File "/Users/prithvi/pyhtonprojects/DjangoProjects/doc_app/venv/lib/python3.7/site-packages/django/core/management/base.py", line 377, in _run_checks
    return checks.run_checks(**kwargs)
  File "/Users/prithvi/pyhtonprojects/DjangoProjects/doc_app/venv/lib/python3.7/site-packages/django/core/checks/registry.py", line 72, in run_checks
    new_errors = check(app_configs=app_configs)
  File "/Users/prithvi/pyhtonprojects/DjangoProjects/doc_app/venv/lib/python3.7/site-packages/django/core/checks/urls.py", line 13, in check_url_config
    return check_resolver(resolver)
  File "/Users/prithvi/pyhtonprojects/DjangoProjects/doc_app/venv/lib/python3.7/site-packages/django/core/checks/urls.py", line 23, in check_resolver
    return check_method()
  File "/Users/prithvi/pyhtonprojects/DjangoProjects/doc_app/venv/lib/python3.7/site-packages/django/urls/resolvers.py", line 399, in check
    for pattern in self.url_patterns:
  File "/Users/prithvi/pyhtonprojects/DjangoProjects/doc_app/venv/lib/python3.7/site-packages/django/utils/functional.py", line 80, in __get__
    res = instance.__dict__[self.name] = self.func(instance)
  File "/Users/prithvi/pyhtonprojects/DjangoProjects/doc_app/venv/lib/python3.7/site-packages/django/urls/resolvers.py", line 584, in url_patterns
    patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)
  File "/Users/prithvi/pyhtonprojects/DjangoProjects/doc_app/venv/lib/python3.7/site-packages/django/utils/functional.py", line 80, in __get__
    res = instance.__dict__[self.name] = self.func(instance)
  File "/Users/prithvi/pyhtonprojects/DjangoProjects/doc_app/venv/lib/python3.7/site-packages/django/urls/resolvers.py", line 577, in urlconf_module
    return import_module(self.urlconf_name)
  File "/Users/prithvi/pyhtonprojects/DjangoProjects/doc_app/venv/lib/python3.7/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
  File "<frozen importlib._bootstrap>", line 983, in _find_and_load
  File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 728, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/Users/prithvi/pyhtonprojects/DjangoProjects/doc_app/web_app/web_app/urls.py", line 18, in <module>
    from web_app.mob_apis.views import login
ModuleNotFoundError: No module named 'web_app.mob_apis'

问题来源StackOverflow 地址:/questions/59379631/django-nomodulefounderror

展开
收起
kun坤 2019-12-29 21:55:51 488 0
1 条回答
写回答
取消 提交回答
  • 试着用

    from mob_apis.views import login
    

    而不是

    from web_app.mob_apis.views import login
    

    在你的 doc_app / web_app web_app / urls . py文件

    2019-12-29 21:56:02
    赞同 展开评论 打赏
问答分类:
问答地址:
问答排行榜
最热
最新

相关电子书

更多
低代码开发师(初级)实战教程 立即下载
冬季实战营第三期:MySQL数据库进阶实战 立即下载
阿里巴巴DevOps 最佳实践手册 立即下载