- 报错类型属于不能重入的问题。
- 根据资料搜集呢, 解决问题的相关办法 :
错误示例
Traceback (most recent call last):
File "manage.py", line 14, in <module>
execute_from_command_line(sys.argv)
File "F:\env\bin\Python37\lib\site-packages\django\core\management\__init__.py", line 381, in execute_from_command_line
utility.execute()
File "F:\env\bin\Python37\lib\site-packages\django\core\management\__init__.py", line 357, in execute
django.setup()
File "F:\env\bin\Python37\lib\site-packages\django\__init__.py", line 24, in setup
apps.populate(settings.INSTALLED_APPS)
File "F:\env\bin\Python37\lib\site-packages\django\apps\registry.py", line 81, in populate
raise RuntimeError("populate() isn't reentrant")
RuntimeError: populate() isn't reentrant
解决办法(这样做即将在控制台输出实际的错误信息,以便于我们去做判断)
-
进入 F:\env\bin\Python37\lib\site-packages\django\apps\registry.py 文件。
-
将 报错行 81 行 的异常抛出代码:
raise RuntimeError("populate() isn't reentrant")
注释并替换成self.app_configs = {}
。
最终诱发我错误的原因是:
TypeError: __init__() missing 1 required positional argument: 'on_delete'
原因是我升级并使用了django 2.2.9, 但是django-celery的版本是3.1.2,
解决办法:
升级django-celery 版本为 3.2.2 兼容版本就好
安装命令:
pip install django-celery==3.2.2
结束标语
目标的坚定是性格中最必要的力量源泉之一,
也是成功的利器之一。
没有它,天才也会在矛盾无定的迷径中徒劳无功。