Django停止使用RuntimeError:populate()不可重入

我一直在用WSGI开发部署在Apache服务器上的Django Web应用程序,并且一切都一帆风顺。 今天,我对应用程序的admin.py进行了一些小的修改,试图定制内置的Django Admin界面,并且最初发生了一个语法错误(一个未封闭的括号)。 这意味着,当我触摸wsgi.py并加载代码(我的虚拟主机上的WSGI以守护进程模式运行)时,我的网站被replace为内部服务器错误,因为当WSGI遇到语法错误时停止。

所以我修复了语法错误,检查了我没有更多的manage.py check ,并且触摸了wsgi.py来重新部署。 但是我的网站仍然显示内部服务器错误! 检查Apache日志,这是我看到:

 [Sun Nov 23 13:52:46 2014] [info] mod_wsgi (pid=19093): Create interpreter 'quotes.cs.cornell.edu|'. [Sun Nov 23 13:52:46 2014] [info] mod_wsgi (pid=19093): Adding '/extra/www/html/quotes/quotes_django' to path. [Sun Nov 23 13:52:46 2014] [info] mod_wsgi (pid=19093): Adding '/opt/rh/python27/root/usr/lib64/python2.7/site- packages/' to path. [Sun Nov 23 13:52:46 2014] [info] [client 128.84.33.19] mod_wsgi (pid=19093, process='quotes.cs.cornell.edu', application='quotes.cs.cornell.edu|'): Loading WSGI script '/extra/www/html/quotes/quotes_django/quotes_django/ wsgi.py'. [Sun Nov 23 13:52:46 2014] [error] [client 128.84.33.19] mod_wsgi (pid=19093): Target WSGI script '/extra/www/html/ quotes/quotes_django/quotes_django/wsgi.py' cannot be loaded as Python module. [Sun Nov 23 13:52:46 2014] [error] [client 128.84.33.19] mod_wsgi (pid=19093): Exception occurred processing WSGI script '/extra/www/html/quotes/quotes_django/quotes_django/wsgi.py'. [Sun Nov 23 13:52:46 2014] [error] [client 128.84.33.19] Traceback (most recent call last): [Sun Nov 23 13:52:46 2014] [error] [client 128.84.33.19] File "/extra/www/html/quotes/quotes_django/ quotes_django/wsgi.py", line 14, in <module> [Sun Nov 23 13:52:46 2014] [error] [client 128.84.33.19] application = get_wsgi_application() [Sun Nov 23 13:52:46 2014] [error] [client 128.84.33.19] File "/opt/rh/python27/root/usr/lib64/python2.7/site- packages/django/core/wsgi.py", line 14, in get_wsgi_application [Sun Nov 23 13:52:46 2014] [error] [client 128.84.33.19] django.setup() [Sun Nov 23 13:52:46 2014] [error] [client 128.84.33.19] File "/opt/rh/python27/root/usr/lib64/python2.7/site- packages/django/__init__.py", line 21, in setup [Sun Nov 23 13:52:46 2014] [error] [client 128.84.33.19] apps.populate(settings.INSTALLED_APPS) [Sun Nov 23 13:52:46 2014] [error] [client 128.84.33.19] File "/opt/rh/python27/root/usr/lib64/python2.7/site- packages/django/apps/registry.py", line 115, in populate [Sun Nov 23 13:52:46 2014] [error] [client 128.84.33.19] app_config.ready() [Sun Nov 23 13:52:46 2014] [error] [client 128.84.33.19] File "/opt/rh/python27/root/usr/lib64/python2.7/site- packages/django/contrib/admin/apps.py", line 22, in ready [Sun Nov 23 13:52:46 2014] [error] [client 128.84.33.19] self.module.autodiscover() [Sun Nov 23 13:52:46 2014] [error] [client 128.84.33.19] File "/opt/rh/python27/root/usr/lib64/python2.7/site- packages/django/contrib/admin/__init__.py", line 23, in autodiscover [Sun Nov 23 13:52:46 2014] [error] [client 128.84.33.19] autodiscover_modules('admin', register_to=site) [Sun Nov 23 13:52:46 2014] [error] [client 128.84.33.19] File "/opt/rh/python27/root/usr/lib64/python2.7/site- packages/django/utils/module_loading.py", line 74, in autodiscover_modules [Sun Nov 23 13:52:46 2014] [error] [client 128.84.33.19] import_module('%s.%s' % (app_config.name, module_to_search)) [Sun Nov 23 13:52:46 2014] [error] [client 128.84.33.19] File "/usr/lib64/python2.7/importlib/__init__.py", line 37, in import_module [Sun Nov 23 13:52:46 2014] [error] [client 128.84.33.19] __import__(name) [Sun Nov 23 13:52:46 2014] [error] [client 128.84.33.19] File "/extra/www/html/quotes/quotes_django/quotespage/ admin.py", line 25 [Sun Nov 23 13:52:46 2014] [error] [client 128.84.33.19] approve_quotes.short_description = "Approve selected quotes" [Sun Nov 23 13:52:46 2014] [error] [client 128.84.33.19] ^ [Sun Nov 23 13:52:46 2014] [error] [client 128.84.33.19] SyntaxError: invalid syntax [Sun Nov 23 13:53:36 2014] [info] [client 128.84.33.19] mod_wsgi (pid=19093, process='quotes.cs.cornell.edu', application='quotes.cs.cornell.edu|'): Loading WSGI script '/extra/www/html/quotes/quotes_django/quotes_django/ wsgi.py'. [Sun Nov 23 13:53:36 2014] [error] [client 128.84.33.19] mod_wsgi (pid=19093): Target WSGI script '/extra/www/html/ quotes/quotes_django/quotes_django/wsgi.py' cannot be loaded as Python module. [Sun Nov 23 13:53:36 2014] [error] [client 128.84.33.19] mod_wsgi (pid=19093): Exception occurred processing WSGI script '/extra/www/html/quotes/quotes_django/quotes_django/wsgi.py'. [Sun Nov 23 13:53:36 2014] [error] [client 128.84.33.19] Traceback (most recent call last): [Sun Nov 23 13:53:36 2014] [error] [client 128.84.33.19] File "/extra/www/html/quotes/quotes_django/ quotes_django/wsgi.py", line 14, in <module> [Sun Nov 23 13:53:36 2014] [error] [client 128.84.33.19] application = get_wsgi_application() [Sun Nov 23 13:53:36 2014] [error] [client 128.84.33.19] File "/opt/rh/python27/root/usr/lib64/python2.7/site- packages/django/core/wsgi.py", line 14, in get_wsgi_application [Sun Nov 23 13:53:36 2014] [error] [client 128.84.33.19] django.setup() [Sun Nov 23 13:53:36 2014] [error] [client 128.84.33.19] File "/opt/rh/python27/root/usr/lib64/python2.7/site- packages/django/__init__.py", line 21, in setup [Sun Nov 23 13:53:36 2014] [error] [client 128.84.33.19] apps.populate(settings.INSTALLED_APPS) [Sun Nov 23 13:53:36 2014] [error] [client 128.84.33.19] File "/opt/rh/python27/root/usr/lib64/python2.7/site- packages/django/apps/registry.py", line 78, in populate [Sun Nov 23 13:53:36 2014] [error] [client 128.84.33.19] raise RuntimeError("populate() isn't reentrant") [Sun Nov 23 13:53:36 2014] [error] [client 128.84.33.19] RuntimeError: populate() isn't reentrant 

第一个错误系列显示WSGI由于我的admin.py的语法错误而admin.py 。 但是,第二个错误系列似乎显示Django的内部错误:

 RuntimeError: populate() isn't reentrant 

registry.pypopulate方法抛出。

谷歌search这个错误消息返回令人惊讶的是很less的信息,从Django文档没有。 显然,如果你在settings.py中给应用程序命名两次,有时会发生,但是我没有这样做。 更重要的是,我没有改变settings.py因为网站工作正常的点 – 我改变的唯一的事情是admin.py

我尝试恢复所做的所有更改,所以我所有的Python代码都回到了网站工作时的状态 – 而且当我尝试使WSGI重新加载代码时,我仍然得到populate() isn't reentrant错误!

我也尝试在settings.py的INSTALLED_APPS部分注释不同的应用程序,即使只启用了“django.contrib.staticfiles”,错误仍然会发生。 奇怪的是,即使我注释掉了所有的应用程序,我仍然得到错误 – Django即使没有加载任何应用程序也会抛出错误!

有人知道这里发生了什么? 或者更好的方法来debugging这个错误,因为Apache日志中的回溯是相当无益的?

注意:我使用Django 1.7,Apache 2.2和Python 2.7。

我的服务器的pipe理员重新启动Apache,神奇地解决了这个问题。 加载完全相同的Python文件不会导致populate() isn't reentrant 。 我什至尝试加载另一个语法错误的文件,然后修复它,服务器能够加载新的文件,正确运行没有问题。

我仍然不知道什么地方出了问题,但是我把这个问题标记为问题已经解决了。 (好吧,只要StackOverflow允许我接受我自己的答案,我会将其标记为已回答。)

更新 :当我不小心上传Python语法错误时,继续得到这个错误,我想出了一个解决方法,比重新启动Apache更容易。 当WSGI开始抛出populate() isn't reentrant错误,我用这个简单的函数replace我的Django项目的wsgi.py

 def application(environ, start_response): if environ['mod_wsgi.process_group'] != '': import signal os.kill(os.getpid(), signal.SIGINT) return ["killed"] 

然后我重新加载我的网站,WSGI守护进程重新启动(我可以通过查看Apache日志,即使网站仍然显示相同的500错误)告诉。

如果我然后改变wsgi.py恢复正常,并重新加载,WSGI成功拿起我的代码没有抛出populate() isn't reentrant (假设我没有语法错误这一次)。 所以整个Apache不需要重新启动,只需要WSGI进程,我可以做到没有root权限。

如果您在使用Google App Engine时遇到此错误,请检查您的日志以查找可能导致此错误的其他错误。 我得到:

ImproperlyConfigured: Error loading either pysqlite2 or sqlite3 modules (tried in that order): No module named _sqlite3

你不能在SQL App中使用SQL App,所以在settings.pyDATABASES部分注释掉了这个错误,并且RuntimeError("populate() isn't reentrant")错误。

我知道这是一个旧的答案,但我会贡献我的解决scheme:

作为一种诊断问题来源的方法,运行manage.py check是否在那里find任何东西

在我的情况下,过时的要求是这个问题,django没有导入子模块

确保您的要求是最新的

这不是一个回应,而是一个反思。

当你升级到Django 1.7并且你有一个500错误并重新载入你的页面时,Apache说“pupulate()不可重入”。 我想这是当你加载你的页面,Apache加载你的应用程序所需的所有模块,当error handling它不会卸载模块。 所以,当你重新加载你的页面,Apache再次加载这些模块,但它已经加载。 所以,Apache说:“填充()不可重入”。

我有两个操作来纠正这个问题:重新启动apache,或更正处理第一个10000错误的错误。

我希望这会帮助你。

您可以通过触摸加载过程中早期的文件(而不是wsgi.py)重新启动Apache来解决此问题。 例如,您的设置文件:

 $ touch settings.py 

我还没有妥善解决这个,但更多的信息在我的问题在这里: 代码更改监控故障Django 1.7 mod-wsgi

Apache将wsgi文件存储在其caching中。 禁用Apache文件的caching

所以首先删除wsgi文件并重启你的acpache,然后再添加wsgi文件并重启apache。

我刚刚面对同样的问题,所以我开始环顾四周。

现在我工作了,所以我想我应该与大家分享!

我所做的只是将chown user:group /to/path -Rchmod 770 /to/path -R全部重新运行。

这看起来像一个相同的Apache mod-wsgi错误的有效答案的好集合,每个人发布一个适合他/她的,所以这里是我的:

不要忘记部署后更新你的项目需求:)

设置:Ubuntu 14.04,Django 1.10,Python 3.5(在virtualenv )。

我尝试了许多这些解决scheme,但没有运气,但后来我发现Apache错误日志在我的情况下包含两个不同的错误。 当有人试图访问一个页面时发生,另一个发生在启动时。 我错过了初创公司,因为我经常尝试刷新页面几次,因此只看到了访问错误重复了几次。

然后我寻找解决scheme的启动错误,而这个问题的解决scheme为我工作 。 简而言之,它涉及以迂回的方式更新mod_wsgi包。

几个月来,我一直在接受有关mod_wsgi版本不匹配的警告,但是突然之间导致了Apache 500错误。 对我没有任何意义。

我的猜测是,这个RuntimeError: populate() isn't reentrant错误通常是一个迹象,应该寻找一个启动错误,这表明真正的问题。

访问

 [Sat Oct 15 03:38:08.900966 2016] [:error] [pid 28272] [remote 95.166.81.114:39651] mod_wsgi (pid=28272): Target WSGI script '/django/GP/GP/wsgi.py' cannot be loaded as Python module. [Sat Oct 15 03:38:08.901409 2016] [:error] [pid 28272] [remote 95.166.81.114:39651] mod_wsgi (pid=28272): Exception occurred processing WSGI script '/django/GP/GP/wsgi.py'. [Sat Oct 15 03:38:08.901662 2016] [:error] [pid 28272] [remote 95.166.81.114:39651] Traceback (most recent call last): [Sat Oct 15 03:38:08.902184 2016] [:error] [pid 28272] [remote 95.166.81.114:39651] File "/django/GP/GP/wsgi.py", line 16, in <module> [Sat Oct 15 03:38:08.902217 2016] [:error] [pid 28272] [remote 95.166.81.114:39651] application = get_wsgi_application() [Sat Oct 15 03:38:08.902501 2016] [:error] [pid 28272] [remote 95.166.81.114:39651] File "/django/env/lib/python3.5/site-packages/django/core/wsgi.py", line 13, in get_wsgi_application [Sat Oct 15 03:38:08.902529 2016] [:error] [pid 28272] [remote 95.166.81.114:39651] django.setup(set_prefix=False) [Sat Oct 15 03:38:08.902726 2016] [:error] [pid 28272] [remote 95.166.81.114:39651] File "/django/env/lib/python3.5/site-packages/django/__init__.py", line 27, in setup [Sat Oct 15 03:38:08.902755 2016] [:error] [pid 28272] [remote 95.166.81.114:39651] apps.populate(settings.INSTALLED_APPS) [Sat Oct 15 03:38:08.902924 2016] [:error] [pid 28272] [remote 95.166.81.114:39651] File "/django/env/lib/python3.5/site-packages/django/apps/registry.py", line 78, in populate [Sat Oct 15 03:38:08.902953 2016] [:error] [pid 28272] [remote 95.166.81.114:39651] raise RuntimeError("populate() isn't reentrant") [Sat Oct 15 03:38:08.903111 2016] [:error] [pid 28272] [remote 95.166.81.114:39651] RuntimeError: populate() isn't reentrant 

启动

 [Sat Oct 15 03:38:08.900966 2016] [:error] [pid 28272] [remote 95.166.81.114:39651] mod_wsgi (pid=28272): Target WSGI script '/django/GP/GP/wsgi.py' cannot be loaded as Python module. [Sat Oct 15 03:38:08.901409 2016] [:error] [pid 28272] [remote 95.166.81.114:39651] mod_wsgi (pid=28272): Exception occurred processing WSGI script '/django/GP/GP/wsgi.py'. [Sat Oct 15 03:38:08.901662 2016] [:error] [pid 28272] [remote 95.166.81.114:39651] Traceback (most recent call last): [Sat Oct 15 03:38:08.902184 2016] [:error] [pid 28272] [remote 95.166.81.114:39651] File "/django/GP/GP/wsgi.py", line 16, in <module> [Sat Oct 15 03:38:08.902217 2016] [:error] [pid 28272] [remote 95.166.81.114:39651] application = get_wsgi_application() [Sat Oct 15 03:38:08.902501 2016] [:error] [pid 28272] [remote 95.166.81.114:39651] File "/django/env/lib/python3.5/site-packages/django/core/wsgi.py", line 13, in get_wsgi_application [Sat Oct 15 03:38:08.902529 2016] [:error] [pid 28272] [remote 95.166.81.114:39651] django.setup(set_prefix=False) [Sat Oct 15 03:38:08.902726 2016] [:error] [pid 28272] [remote 95.166.81.114:39651] File "/django/env/lib/python3.5/site-packages/django/__init__.py", line 27, in setup [Sat Oct 15 03:38:08.902755 2016] [:error] [pid 28272] [remote 95.166.81.114:39651] apps.populate(settings.INSTALLED_APPS) [Sat Oct 15 03:38:08.902924 2016] [:error] [pid 28272] [remote 95.166.81.114:39651] File "/django/env/lib/python3.5/site-packages/django/apps/registry.py", line 78, in populate [Sat Oct 15 03:38:08.902953 2016] [:error] [pid 28272] [remote 95.166.81.114:39651] raise RuntimeError("populate() isn't reentrant") [Sat Oct 15 03:38:08.903111 2016] [:error] [pid 28272] [remote 95.166.81.114:39651] RuntimeError: populate() isn't reentrant [Sat Oct 15 03:38:43.291502 2016] [:error] [pid 28272] Exception ignored in: <module 'threading' from '/usr/lib/python3.4/threading.py'> [Sat Oct 15 03:38:43.291579 2016] [:error] [pid 28272] Traceback (most recent call last): [Sat Oct 15 03:38:43.291604 2016] [:error] [pid 28272] File "/usr/lib/python3.4/threading.py", line 1288, in _shutdown [Sat Oct 15 03:38:43.292356 2016] [:error] [pid 28272] assert tlock is not None [Sat Oct 15 03:38:43.292377 2016] [:error] [pid 28272] AssertionError: [Fri Oct 14 23:38:43.412942 2016] [:error] [pid 28299] Exception ignored in: <module 'threading' from '/usr/lib/python3.4/threading.py'> [Fri Oct 14 23:38:43.413044 2016] [:error] [pid 28299] Traceback (most recent call last): [Fri Oct 14 23:38:43.413076 2016] [:error] [pid 28299] File "/usr/lib/python3.4/threading.py", line 1288, in _shutdown [Fri Oct 14 23:38:43.425037 2016] [:error] [pid 28275] Exception ignored in: <module 'threading' from '/usr/lib/python3.4/threading.py'> [Fri Oct 14 23:38:43.425125 2016] [:error] [pid 28275] Traceback (most recent call last): [Fri Oct 14 23:38:43.425157 2016] [:error] [pid 28275] File "/usr/lib/python3.4/threading.py", line 1288, in _shutdown [Fri Oct 14 23:38:43.427625 2016] [:error] [pid 28274] Exception ignored in: <module 'threading' from '/usr/lib/python3.4/threading.py'> [Fri Oct 14 23:38:43.427694 2016] [:error] [pid 28274] Traceback (most recent call last): [Fri Oct 14 23:38:43.427722 2016] [:error] [pid 28274] File "/usr/lib/python3.4/threading.py", line 1288, in _shutdown [Fri Oct 14 23:38:43.432020 2016] [:error] [pid 28273] Exception ignored in: <module 'threading' from '/usr/lib/python3.4/threading.py'> [Fri Oct 14 23:38:43.432078 2016] [:error] [pid 28273] Traceback (most recent call last): [Fri Oct 14 23:38:43.432105 2016] [:error] [pid 28273] File "/usr/lib/python3.4/threading.py", line 1288, in _shutdown [Fri Oct 14 23:38:43.438577 2016] [:error] [pid 28299] assert tlock is not None [Fri Oct 14 23:38:43.438654 2016] [:error] [pid 28299] AssertionError: [Fri Oct 14 23:38:43.442174 2016] [:error] [pid 28274] assert tlock is not None [Fri Oct 14 23:38:43.442226 2016] [:error] [pid 28274] AssertionError: [Fri Oct 14 23:38:43.447227 2016] [:error] [pid 28276] Exception ignored in: <module 'threading' from '/usr/lib/python3.4/threading.py'> [Fri Oct 14 23:38:43.447294 2016] [:error] [pid 28276] Traceback (most recent call last): [Fri Oct 14 23:38:43.447326 2016] [:error] [pid 28276] File "/usr/lib/python3.4/threading.py", line 1288, in _shutdown [Fri Oct 14 23:38:43.448813 2016] [:error] [pid 28277] Exception ignored in: <module 'threading' from '/usr/lib/python3.4/threading.py'> [Fri Oct 14 23:38:43.448876 2016] [:error] [pid 28277] Traceback (most recent call last): [Fri Oct 14 23:38:43.448903 2016] [:error] [pid 28277] File "/usr/lib/python3.4/threading.py", line 1288, in _shutdown [Fri Oct 14 23:38:43.450188 2016] [:error] [pid 28273] assert tlock is not None [Fri Oct 14 23:38:43.450231 2016] [:error] [pid 28273] AssertionError: [Fri Oct 14 23:38:43.456680 2016] [:error] [pid 28275] assert tlock is not None [Fri Oct 14 23:38:43.456737 2016] [:error] [pid 28275] AssertionError: [Fri Oct 14 23:38:43.461761 2016] [:error] [pid 28277] assert tlock is not None [Fri Oct 14 23:38:43.461826 2016] [:error] [pid 28277] AssertionError: [Fri Oct 14 23:38:43.466165 2016] [:error] [pid 28276] assert tlock is not None [Fri Oct 14 23:38:43.466219 2016] [:error] [pid 28276] AssertionError: [Fri Oct 14 23:38:43.658971 2016] [mpm_prefork:notice] [pid 28268] AH00169: caught SIGTERM, shutting down [Sat Oct 15 03:38:43.691909 2016] [:error] [pid 28272] Exception ignored in: <module 'threading' from '/usr/lib/python3.4/threading.py'> [Sat Oct 15 03:38:43.691968 2016] [:error] [pid 28272] Traceback (most recent call last): [Sat Oct 15 03:38:43.691996 2016] [:error] [pid 28272] File "/usr/lib/python3.4/threading.py", line 1288, in _shutdown [Sat Oct 15 03:38:43.693126 2016] [:error] [pid 28272] assert tlock is not None [Sat Oct 15 03:38:43.693159 2016] [:error] [pid 28272] AssertionError: [Fri Oct 14 23:38:44.490316 2016] [:warn] [pid 28349] mod_wsgi: Compiled for Python/3.4.0. [Fri Oct 14 23:38:44.490407 2016] [:warn] [pid 28349] mod_wsgi: Runtime using Python/3.4.3. [Fri Oct 14 23:38:44.505672 2016] [mpm_prefork:notice] [pid 28349] AH00163: Apache/2.4.7 (Ubuntu) PHP/5.5.9-1ubuntu4.19 mod_wsgi/3.4 Python/3.4.3 configured -- resuming normal operations [Fri Oct 14 23:38:44.505764 2016] [core:notice] [pid 28349] AH00094: Command line: '/usr/sbin/apache2' 

我有这个问题,找不到任何答案,直到我回溯我的提交。 显然,我添加了一个意外导入,因为自动完成,搞砸了设置。

# found in models.py from msilib.schema import SelfReg

在apache错误日志中:RuntimeError(“populate()不可重入”)

它在我的Windows开发环境中工作正常,但在Ubuntu / Apache服务器上失败。

在改变这个设置的顺序之后,我正在进入同样的错误:

 MIDDLEWARE_CLASSES = ( 'django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.common.CommonMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.auth.middleware.SessionAuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', 'django.middleware.clickjacking.XFrameOptionsMiddleware', 'django.middleware.security.SecurityMiddleware', ) 

把它重新放在这里的命令,重新启动Apache解决了这个问题。

这也可能是由INSTALLED_APPS中的重复条目造成的

在我的情况下,我有一个Django Rest Frameworkcustom renderer class ,出于某种目的,我不得不重写渲染器类的方法“get_context”(完全公开:使django toolbar给出正确的SQL查询计数)

我删除了这个类并重新部署了。 有效。

我知道这个问题已经有一段时间了,但是由于我在这里没有看到这个问题,我只是遇到了这个问题。 我得到了RuntimeError: populate() isn't reentrant由于CentOS 7上的SELinux, RuntimeError: populate() isn't reentrant错误。我有Django服务于主目录,我只需启用允许读取主目录的SELinux布尔值, )错误是由于权限问题。 我的解决scheme是setsebool -P httpd_read_user_content 1 。 我希望这可以帮助有这个问题的人。

在我的情况下,错误发生,因为所需的点子包丢失。

所以我做了一个pip install -r requirements.txt ,重新启动Apache和东西再次工作。

我遇到了同样的问题,错误的来源只是我正在处理的文件中的语法错误。 排除错字后, populate() is not reentrant错误消失。

在我的情况下,我有一个循环导入,导致一个错误,打破了填充方法。

我解决了添加__init__.py到我的应用程序文件夹的问题。

 touch /mainprojectfolder/projectfolderwhichcontainswsgi.py/apps/__init__.py 

然后它的工作!

这种PC /主机/ VPS的内存不足,释放一些内存,一切都会好起来的。