我在使用“ 2 Scoops of Django”项目布局时遇到了这个问题,例如
/project_root /project_dir /config /settings /my_app /tests models.py /requirements readme.rst
该代码正在运行,但是在/ tests中,IntelliJ / PyCharm显示了一个未解决的引用:
from my_app.models import Something
我把所有
__init__.py文件都放好了。我最终不得不将源设置为
project_dir:
右键单击project_dir,将目录标记为> Sources Root



