Django启动的时候报错

File "/home/hehecat/PycharmProjects/MxShop/MxShop/urls.py", line 23, in

from users.views import UserViewSet

File "/home/hehecat/PycharmProjects/MxShop/apps/users/views.py", line 13, in

from users.models import EmailVerifyCode

File "/home/hehecat/PycharmProjects/MxShop/apps/users/models.py", line 8, in

class UserProfile(AbstractUser):

File "/home/hehecat/anaconda3/envs/restful/lib/python3.6/site-packages/django/db/models/base.py", line 118, in new

"INSTALLED_APPS." % (module, name)

RuntimeError: Model class users.models.UserProfile doesn't declare an explicit app_label and isn't in an application in INSTALLED_APPS.

users的model无法正确引入

根据提示去setting中的INSTALLED_APPS 看看

INSTALLED_APPS = [
...
'users.apps.UsersConfig',
...
]

'users.apps.UsersConfig' 直接修改为‘users’,正确

那就是apps.UsersConfig有问题了

users/apps.py

class UsersConfig(AppConfig):
name = 'app.users'
verbose_name = '用户'

name修改name = 'users'为即可

RuntimeError: Model class users.models.UserProfile doesn't declare an explicit app_label and isn't in an application in INSTALLED_APPS.的更多相关文章

  1. Django RuntimeError: Model class app_anme.models.Ad doesn't declare an explicit app_label and isn't in an application in INSTALLED_APPS.报错

    报错内容 RuntimeError: Model class app_anme.models.Ad doesn't declare an explicit app_label and isn't in ...

  2. RuntimeError: Model class user.models.User doesn't declare an explicit app_label and isn't in an application in INSTALLED_APPS.

    Django 2.x版本迁移数据库报这个错误,user表使用的Django的验证系统 本来就想改一下用户表的表名,莫名的报了个这个错误,在网上找到了解决办法 打开user应用模块下的apps.py文件 ...

  3. RuntimeError: Model class app_anme.models.User doesn't declare an explicit app_label and isn't in an application in INSTALLED_APPS.---python学习错误记录

    untimeError: Model class app_anme.models.User doesn't declare an explicit app_label and isn't in an ...

  4. RuntimeError: Model class myapp.models.Test doesn't declare an explicit app_label and isn't in an application in INSTALLED_APPS.

    没有添加子应用在settings里面!

  5. Django开发BUG "Model class WH_auth.models.User doesn't declare an explicit app_label and isn't in an application in INSTALLED_APPS."

    当进行数据库迁移的时候发生问题,报错如下:RuntimeError: Model class WH_auth.models.User doesn't declare an explicit app_l ...

  6. 在views中引用UserProfile报错RuntimeError: Model class apps.users.models.UserProfile doesn't declare an explicit app_label and isn't in an application in INSTALLED_APPS.

    如图报错,在settings中,该加的也加了啊! 显然类似于网上最容易遇到的解决方案如下图,是没有任何意义的 只要在view中有 from .models import UserProfile,Ver ...

  7. django.db.utils.ProgrammingError: (1146, "Table 'db_gold.user_ip_info' doesn't exist") RuntimeError: Model class scanhosts.models.HostLoginInfo doesn't declare an explicit app_label and isn't in an a

    Error Msg 创建了一个apps的目录将所有app放入apps文件中, 将apps路径加入sys.path中:sys.insert(0, os.path.join(BASE_DIR, " ...

  8. RuntimeError: Model class apps.users.models.User doesn't declare an explicit app_label and isn't in an application in INSTALLED_APPS.

    报错代码: File "/home/bsodgm/Desktop/Django_projection/mall/apps/users/views.py", line 9, in & ...

  9. Model class apps.goods.models.GoodsType doesn't declare an explicit app_label and isn't in an application in INSTALLED_APPS

    在admin.py注册这个model时,报了个错: RuntimeError: Model class apps.goods.models.GoodsType doesn't declare an e ...

随机推荐

  1. Socket: java Socket的isConnected()、和isClosed()判断是否在线的问题(转)

    首先,很多初学者都会用这两个API来判断对方是否在线,但是经过我的实践,此API并不能实时判断是否在线的状态. 经过百度查询资料后,得出结论: 事实上这些方法都是访问socket在内存驻留的状态,当s ...

  2. mybatis pagehelper 分页 失效

    pagehelper 不分页几种情况的解决方法 - web洋仔 - CSDN博客https://blog.csdn.net/csdn___lyy/article/details/77160488 分页 ...

  3. Nginx + Naxsi 打造建议WAF

    --prefix=/usr/share/nginx --sbin-path=/usr/sbin/nginx --modules-path=/usr/lib64/nginx/modules --conf ...

  4. Windows下MariaDB数据库安装图文教程

    MariaDB是基于MySQL的开源数据库,兼容MySQL,现有的MySQL数据库可以迁移到MariaDB中使用   说明: MariaDB是基于MySQL的开源数据库,兼容MySQL,现有的MySQ ...

  5. CGI = MCC + MNC + LAC + CI

    CGI = MCC + MNC + LAC + CI 摘自:http://www.360doc.com/content/19/0801/10/65611272_852334484.shtml CGI是 ...

  6. if判断用法

  7. Swift4.0复习结构体

    1.基本语法: /** 定义了一个结构体 */ struct Structure {   /// 一个常量存储式实例属性, /// 并直接为它初始化 let constProperty =   /// ...

  8. MVC4笔记 RedirectResult,RedirectToRoute

    RedirectResult:运行重新导向到其他网址,在RedirectResult的内部,基本上还是以Response.Redirect方法响应HTTP 302暂时导向. eg: public Ac ...

  9. iOS-退出App程序,进入设置页面

     AppDelegate *app = [UIApplication sharedApplication].delegate;     UIWindow *window = app.window;   ...

  10. c# stmp邮件发送

    最近用到了邮件发送功能,因为stmp设置.参数传递错误等一些问题走了弯路,虽然代码很简单,这里还是记录一下,方便下次查阅. 用个人163邮箱测试的邮件发送 class Program { static ...