【发布时间】:2016-09-16 21:37:52
【问题描述】:
我正在我的 django 项目上安装一个新的应用程序(社交)。
当我输入python manage.py runserver 0.0.0.0:8000 时出现以下错误
Unhandled exception in thread started by <bound method Command.inner_run of <django.contrib.staticfiles.management.commands.runserver.Command object at 0x971d56c>>
Traceback (most recent call last):
...
django.core.management.base.CommandError: One or more models did not validate:
social.socialall: "client_name": CharFields require a "max_length"
attribute that is a positive integer.
social.socialall: "customer_name": CharFields require a "max_length" attribute that is a positive integer.
social.socialall: "publisher_id": CharFields require a "max_length" attribute that is a positive integer.
social.socialall: "currency": CharFields require a "max_length" attribute that is a positive integer.
不久前我创建了一个社交模型,但从未使用过它,因此将其从代码中删除。
我正试图找出social.socialall 这个住在哪里。我假设 django.db.models 但我正在查询我的 SQL 数据库并且找不到任何东西。
只有当我在 installed_apps 中包含社交时,我才会收到此错误消息。
【问题讨论】:
-
此时您的数据库无关紧要。引发异常是因为您在代码中的某处定义了此模型类。删除它,你会没事的。