Django在app的model中不要使用绝对路径
2020-03-10 本文已影响0人
python小能手
/vscode/中使用相对路径进行导包
/pycharm/经过了处理,可以使用绝对路径
相对路径从/apps/目录开始如下:
![](https://img.haomeiwen.com/i13944210/5ee0a40846a56abe.png)
否则报错:
RuntimeError: Model class apps.users.models.UserProfile doesn't declare an explicit app_label and isn't in an application in INSTALLED_APPS