0

I am having issues with deploying some recent work on a Django app to my server. On deployment, I updated a few pip modules, and there was also some restructuring of the directories. Once done, I restarted apache2, but was greated by the below error messages which proved unhelpful

[Thu May 13 13:12:09.846428 2021] [wsgi:error] [pid 8385:tid 140483483444992] [remote 2a02:c7f:6c19:2c00:4150:e3c6:fe11:d603:34690] mod_wsgi (pid=8385): Target WSGI script '/var/www/stage.admin.agile.coop/web/mysite/wsgi.py' cannot be loaded as Python module. 
[Thu May 13 13:12:09.846751 2021] [wsgi:error] [pid 8385:tid 140483483444992] [remote 2a02:c7f:6c19:2c00:4150:e3c6:fe11:d603:34690] mod_wsgi (pid=8385): Exception occurred processing WSGI script '/var/www/stage.admin.agile.coop/web/mysite/wsgi.py'. 
[Thu May 13 13:12:09.847024 2021] [wsgi:error] [pid 8385:tid 140483483444992] [remote 2a02:c7f:6c19:2c00:4150:e3c6:fe11:d603:34690] Traceback (most recent call last): 
[Thu May 13 13:12:09.847174 2021] [wsgi:error] [pid 8385:tid 140483483444992] [remote 2a02:c7f:6c19:2c00:4150:e3c6:fe11:d603:34690]   File "/var/www/stage.admin.agile.coop/web/mysite/wsgi.py", line 16, in <module> 
[Thu May 13 13:12:09.847275 2021] [wsgi:error] [pid 8385:tid 140483483444992] [remote 2a02:c7f:6c19:2c00:4150:e3c6:fe11:d603:34690] application = get_wsgi_application() 
[Thu May 13 13:12:09.847363 2021] [wsgi:error] [pid 8385:tid 140483483444992] [remote 2a02:c7f:6c19:2c00:4150:e3c6:fe11:d603:34690]   File "/var/www/stage.admin.agile.coop/venv/lib/python3.6/site-packages/django/core/wsgi.py", line 12, in get_wsgi_application 
[Thu May 13 13:12:09.847460 2021] [wsgi:error] [pid 8385:tid 140483483444992] [remote 2a02:c7f:6c19:2c00:4150:e3c6:fe11:d603:34690]     django.setup(set_prefix=False) 
[Thu May 13 13:12:09.847561 2021] [wsgi:error] [pid 8385:tid 140483483444992] [remote 2a02:c7f:6c19:2c00:4150:e3c6:fe11:d603:34690]   File "/var/www/stage.admin.agile.coop/venv/lib/python3.6/site-packages/django/__init__.py", line 24, in setup 
[Thu May 13 13:12:09.847655 2021] [wsgi:error] [pid 8385:tid 140483483444992] [remote 2a02:c7f:6c19:2c00:4150:e3c6:fe11:d603:34690]     apps.populate(settings.INSTALLED_APPS) 
[Thu May 13 13:12:09.847755 2021] [wsgi:error] [pid 8385:tid 140483483444992] [remote 2a02:c7f:6c19:2c00:4150:e3c6:fe11:d603:34690]   File "/var/www/stage.admin.agile.coop/venv/lib/python3.6/site-packages/django/apps/registry.py", line 83, in populate 
[Thu May 13 13:12:09.847850 2021] [wsgi:error] [pid 8385:tid 140483483444992] [remote 2a02:c7f:6c19:2c00:4150:e3c6:fe11:d603:34690]     raise RuntimeError("populate() isn't reentrant.") 
[Thu May 13 13:12:09.847944 2021] [wsgi:error] [pid 8385:tid 140483483444992] [remote 2a02:c7f:6c19:2c00:4150:e3c6:fe11:d603:34690] RuntimeError: populate() isn't reentrant. 
[Thu May 13 13:12:10.281512 2021] [wsgi:error] [pid 8385:tid 140483365897984] [remote 2a02:c7f:6c19:2c00:4150:e3c6:fe11:d603:34690] mod_wsgi (pid=8385): Target WSGI script '/var/www/stage.admin.agile.coop/web/mysite/wsgi.py' cannot be loaded as Python module. 
[Thu May 13 13:12:10.281766 2021] [wsgi:error] [pid 8385:tid 140483365897984] [remote 2a02:c7f:6c19:2c00:4150:e3c6:fe11:d603:34690] mod_wsgi (pid=8385): Exception occurred processing WSGI script '/var/www/stage.admin.agile.coop/web/mysite/wsgi.py'. 
[Thu May 13 13:12:10.282035 2021] [wsgi:error] [pid 8385:tid 140483365897984] [remote 2a02:c7f:6c19:2c00:4150:e3c6:fe11:d603:34690] Traceback (most recent call last): 
[Thu May 13 13:12:10.282166 2021] [wsgi:error] [pid 8385:tid 140483365897984] [remote 2a02:c7f:6c19:2c00:4150:e3c6:fe11:d603:34690]   File "/var/www/stage.admin.agile.coop/web/mysite/wsgi.py", line 16, in <module> 
[Thu May 13 13:12:10.282266 2021] [wsgi:error] [pid 8385:tid 140483365897984] [remote 2a02:c7f:6c19:2c00:4150:e3c6:fe11:d603:34690] application = get_wsgi_application() 
[Thu May 13 13:12:10.282360 2021] [wsgi:error] [pid 8385:tid 140483365897984] [remote 2a02:c7f:6c19:2c00:4150:e3c6:fe11:d603:34690]   File "/var/www/stage.admin.agile.coop/venv/lib/python3.6/site-packages/django/core/wsgi.py", line 12, in get_wsgi_application 
[Thu May 13 13:12:10.282439 2021] [wsgi:error] [pid 8385:tid 140483365897984] [remote 2a02:c7f:6c19:2c00:4150:e3c6:fe11:d603:34690]     django.setup(set_prefix=False) 
[Thu May 13 13:12:10.282550 2021] [wsgi:error] [pid 8385:tid 140483365897984] [remote 2a02:c7f:6c19:2c00:4150:e3c6:fe11:d603:34690]   File "/var/www/stage.admin.agile.coop/venv/lib/python3.6/site-packages/django/__init__.py", line 24, in setup 
[Thu May 13 13:12:10.282626 2021] [wsgi:error] [pid 8385:tid 140483365897984] [remote 2a02:c7f:6c19:2c00:4150:e3c6:fe11:d603:34690]     apps.populate(settings.INSTALLED_APPS) 
[Thu May 13 13:12:10.282704 2021] [wsgi:error] [pid 8385:tid 140483365897984] [remote 2a02:c7f:6c19:2c00:4150:e3c6:fe11:d603:34690]   File "/var/www/stage.admin.agile.coop/venv/lib/python3.6/site-packages/django/apps/registry.py", line 83, in populate 
[Thu May 13 13:12:10.282791 2021] [wsgi:error] [pid 8385:tid 140483365897984] [remote 2a02:c7f:6c19:2c00:4150:e3c6:fe11:d603:34690]     raise RuntimeError("populate() isn't reentrant.") [Thu May 13 13:12:10.282883 2021] [wsgi:error] [pid 8385:tid 140483365897984] [remote 2a02:c7f:6c19:2c00:4150:e3c6:fe11:d603:34690] RuntimeError: populate() isn't reentrant.

On getting this, I followed some of the debugging tips on posts such as Django stops working with RuntimeError: populate() isn't reentrant which uncovered some modules to update in pip. Once done, those messages went away, but I still get this message.

Any further tips on how to debug this would be greatly received.

Dan

retrodans
  • 123
  • 1
  • 1
  • 9
  • for this message ... RuntimeError("populate() isn't reentrant.") ... it is important to find the first error message in Apache error log file after restarting Apache. So please stop/start Apache and see if there is a different (another) error message first. – Razenstein May 13 '21 at 15:54
  • if there is nothing to find change registry.py like explained here and see if there is more clear error message: https://stackoverflow.com/questions/27093746/django-stops-working-with-runtimeerror-populate-isnt-reentrant?noredirect=1&lq=1 – Razenstein May 13 '21 at 15:57
  • Thanks @Razenstein that was the missing part, the issue only showed on the first request after apache restarted, whereas I was testing by restarting once, then doing multiple refreshes, so missing the helpful info. Feel free to put both of your suggestions in as a single answer (as both were correct in my case) and I will mark as the answer for you. – retrodans May 14 '21 at 09:57

1 Answers1

0
  1. for this message ... RuntimeError("populate() isn't reentrant.") ... it is important to find the first error message in Apache error log file after restarting Apache. So please stop/start Apache and see if there is a different (another) error message first.

  2. if there is nothing to find change registry.py like explained here and see if there is more clear error message: Django stops working with RuntimeError: populate() isn't reentrant

Razenstein
  • 3,532
  • 2
  • 5
  • 17