运行环境
PyCharm 2017.1
Django 2.0.1
python 3.6.1
使用相对路径引用Models模块
from .models import *
1
在同时存在多个apps的情况下,有机会报错
RuntimeError: Model class app_anme.models.Ad doesn't declare an explicit app_label and isn't in an application in INSTALLED_APPS.
1
解决办法
使用绝对路径引用 以后不能采用点的方式了
from app_name.models import *
————————————————
相关文章
- 03-05报错RuntimeError: Model class apps.user.models.User doesn't declare an explicit app_label and isn
- 03-05关于Django项目启动报错RuntimeError: Model class wechat.models.UserInfo doesn't declare an explicit app_
- 03-05django启动服务时报错:RuntimeError: Model class index.models.User doesn't declare an explicit app_label and isn't in an application in INSTALLED_APPS.
- 03-05Django 使用allauth报错 RuntimeError: Model class django.contrib.sites.models.Site doesn't declare an explicit app_label and isn't in an application in INSTALLED_APPS
- 03-05Model class apps.goods.models.GoodsType doesn't declare an explicit app_label and isn't in an application in INSTALLED_APPS