run manage.py task 出现如下错误 怎样解决?
来源:3-6 migrations原理及表生成
燚x
2017-12-11
Failed to get real commands on module "Shop": python process died with code 1: Traceback (most recent call last): File "F:\软件\PyCharm 2017.3\helpers\pycharm\_jb_manage_tasks_provider.py", line 25, in <module> django.setup() File "C:\Users\lenovo\AppData\Local\Programs\Python\Python36\lib\site-packages\django\__init__.py", line 24, in setup apps.populate(settings.INSTALLED_APPS) File "C:\Users\lenovo\AppData\Local\Programs\Python\Python36\lib\site-packages\django\apps\registry.py", line 112, in populate app_config.import_models() File "C:\Users\lenovo\AppData\Local\Programs\Python\Python36\lib\site-packages\django\apps\config.py", line 198, in import_models self.models_module = import_module(models_module_name) File "C:\Users\lenovo\AppData\Local\Programs\Python\Python36\lib\importlib\__init__.py", line 126, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "<frozen importlib._bootstrap>", line 978, in _gcd_import File "<frozen importlib._bootstrap>", line 961, in _find_and_load File "<frozen importlib._bootstrap>", line 950, in _find_and_load_unlocked File "<frozen importlib._bootstrap>", line 655, in _load_unlocked File "<frozen importlib._bootstrap_external>", line 678, in exec_module File "<frozen importlib._bootstrap>", line 205, in _call_with_frames_removed File "F:\django\Shop\apps\goods\models.py", line 8, in <module> class GoodsCategory(models.Model): File "F:\django\Shop\apps\goods\models.py", line 22, in GoodsCategory parent_category = models.ForeignKey("self", null=True, blank=True, verbose_name="父类目级别", help_text="父目录",related_name="sub_cat") TypeError: __init__() missing 1 required positional argument: 'on_delete'
写回答
1回答
-
请叫我小果酱3620195
2017-12-12
第一个:就是确定将goods放入INSTALLED_APPS中 第二个:确定models是否按照老师写法,就是没有__init__
062017-12-18
Python前后端分离开发Vue+Django REST framework实战
Django REST framework课程视频,RESTFul API前后端分离开发
2873 学习 · 2457 问题
相似问题