django
weixin_1135581478
吃亏是福
展开
-
Model class apps.usersmodelsUser declare an explicit app_label and in an application INSTALLED_APPS
问题报错内容:RuntimeError: Model class apps.users.models.User doesn’t declare an explicit app_label and isn’t in an application in INSTALLED_APPS.问题描述:在 Pycharm 中使用ipython,导入 from apps.users.serializers import *时提示(如下图):问题原因:应用users上面嵌套里一层 apps,在自动创建应用时,ap原创 2022-03-03 21:58:37 · 964 阅读 · 0 评论 -
Mac:sh: /Users/lipan/Downloads/Django/node_modules/.bin/vue-cli-service: Permission denied
问题描述:使用HbuilderX工具运行VUE框架代码时提示:sh: /Users/lipan/Downloads/Django/node_modules/.bin/vue-cli-service: Permission denied如图:解决方法:在 terminals 中cd到所在项目根目录(一定是根目录哦) 在根目录下输入命令`MacBook-Pro% chmod 777 node_modules/.bin/vue-cli-service` 在根目录下执行命令:npm ru..原创 2022-03-03 11:51:35 · 876 阅读 · 0 评论 -
MySQLdb._exceptions.OperationalError: (1050, “Table ‘django_content_type‘ already exists“)
问题:手动删除了数据库的表后,再次创建模型后,进行迁移时提示(如下图)解决方法执行命令:`python manage.py migrate users --fake` (users为模型名称,更改为你的模型名称) 执行命令:`python manage.py migrate`查看数据库(已有tb_user表),完美解决问题....原创 2022-03-01 14:34:25 · 1091 阅读 · 0 评论 -
DjangoRestFramework报错:Got AttributeError when attempting to get a value for field `name` on serializ
在使用DRF序列化器时,通过网页端,访问数据列表时提示:Got AttributeError when attempting to get a value for field name on serializer StudentSerializers.The serializer field might be named incorrectly and not match any attribute or key on the QuerySet instance.Original exception原创 2022-02-18 10:52:43 · 1676 阅读 · 0 评论