首页 > 解决方案 > Django 错误 - ImportError:无法从“first_project”导入名称“first_app”

问题描述

我是 Django 新手,并开始使用新项目。

我在尝试传递应用程序 URL 时遇到了这个问题。

ImportError:无法从“first_project”导入名称“first_app”(E:\Project\DjangoProject\first_project\first_project_init _.py

first_app 中的 view.py

first_app 中的 urls.py

first_project 中的 urls.py

标签: pythonpython-3.xdjangodjango-modelsdjango-forms

解决方案


You should remove the:

from first_project import first_app

in your first_app/urls.py. Normally the Python root path is located at the directory that contains the manage.py file, so there is no module named first_project.


推荐阅读