在執行數據庫遷移的時候報出錯誤RuntimeError: populate() isn't reentrant,以前也出過這個錯誤,可是忘記記錄了,此次又出現了。百度搜好好多,都沒解決個人問題,這裏作個踩坑記錄。python
背景:項目有多個app,如今新需求增長了一個app,並編寫了該app的utils文件數據庫
在執行python manage.py makemigrations後報出以下異常django
Traceback (most recent call last): File "manage.py", line 14, in <module> execute_from_command_line(sys.argv) File "D:\Program Files\Python37\lib\site-packages\django\core\management\__init__.py", line 381, in execute_from_command_line utility.execute() File "D:\Program Files\Python37\lib\site-packages\django\core\management\__init__.py", line 357, in execute django.setup() File "D:\Program Files\Python37\lib\site-packages\django\__init__.py", line 24, in setup apps.populate(settings.INSTALLED_APPS) File "D:\Program Files\Python37\lib\site-packages\django\apps\registry.py", line 81, in populate raise RuntimeError("populate() isn't reentrant") RuntimeError: populate() isn't reentrant
跟着錯誤信息,初步斷定是新建立的app才引起的此問題,因此就把INSTALLED_APPS中新建立的app註釋掉,再執行python manage.py makemigrations就不報異常了。app
因此錯誤信息應當在新app中,在檢查到utils文件時,發現引入包的方式有問題code
文件目錄爲blog
未修改時引入方式爲it
修改後方式爲io
就是在引入TLSSigAPI模塊時加上app的名稱ast
總結:在新建app並初始化後,若是提示RuntimeError: populate() isn't reentrant錯誤,應該先檢查每一個app的模塊引入狀況。class