mod_wsgi : Target WSGI script '/var/www/project_folder/project_folder/wsgi.py' cannot be loaded as Python module.

20 views
Skip to first unread message

sanjay mangalaram

unread,
Nov 26, 2019, 2:05:55 PM11/26/19
to modwsgi
I am using Ubuntu16.04 with Python3. While runserver command is ON I am able to access the site. Now I am setting the WSGI for auto run. But it giving the error, please check the following log 

[Tue Nov 26 13:56:40.427968 2019] [wsgi:error] [pid 16:tid 13992] [remote 203.109.87.98:11585] mod_wsgi (pid=16): Exception occurred processing WSGI script '/var/www/project_folder/project_folder/wsgi.py'.
[Tue Nov 26 13:56:40.428058 2019] [wsgi:error] [pid 16:tid 13992] [remote 203.109.87.98:11585] Traceback (most recent call last):
[Tue Nov 26 13:56:40.428082 2019] [wsgi:error] [pid 16:tid 13992] [remote 203.109.87.98:11585]   File "/var/www/project_folder/project_folder/wsgi.py", line 17, in <module>
[Tue Nov 26 13:56:40.428085 2019] [wsgi:error] [pid 16:tid 13992] [remote 203.109.87.98:11585]     application = get_wsgi_application()
[Tue Nov 26 13:56:40.428090 2019] [wsgi:error] [pid 16:tid 13992] [remote 203.109.87.98:11585]   File "/var/www/projectenv/lib/python3.6/site-packages/django/core/wsgi.py", line 12, in get_wsgi_application
[Tue Nov 26 13:56:40.428093 2019] [wsgi:error] [pid 16:tid 13992] [remote 203.109.87.98:11585]     django.setup(set_prefix=False)
[Tue Nov 26 13:56:40.428098 2019] [wsgi:error] [pid 16:tid 13992] [remote 203.109.87.98:11585]   File "/var/www/projectenv/lib/python3.6/site-packages/django/__init__.py", line 24, in setup
[Tue Nov 26 13:56:40.428100 2019] [wsgi:error] [pid 16:tid 13992] [remote 203.109.87.98:11585]     apps.populate(settings.INSTALLED_APPS)
[Tue Nov 26 13:56:40.428105 2019] [wsgi:error] [pid 16:tid 13992] [remote 203.109.87.98:11585]   File "/var/www/projectenv/lib/python3.6/site-packages/django/apps/registry.py", line 83, in populate
[Tue Nov 26 13:56:40.428107 2019] [wsgi:error] [pid 16:tid 13992] [remote 203.109.87.98:11585]     raise RuntimeError("populate() isn't reentrant")
[Tue Nov 26 13:56:40.428119 2019] [wsgi:error] [pid 16:tid 13992] [remote 203.109.87.98:11585] RuntimeError: populate() isn't reentrant
[Tue Nov 26 13:56:41.568432 2019] [wsgi:error] [pid 16:tid 13992] [remote 203.109.87.98:11585] mod_wsgi (pid=16): Target WSGI script '/var/www/project_folder/project_folder/wsgi.py' cannot be loaded as Python module.
[Tue Nov 26 13:56:41.568455 2019] [wsgi:error] [pid 16:tid 139922] [remote 203.109.87.98:11585] mod_wsgi (pid=16): Exception occurred processing WSGI script '/var/www/project_folder/project_folder/wsgi.py'.
[Tue Nov 26 13:56:41.568518 2019] [wsgi:error] [pid 16:tid 139922] [remote 203.109.87.98:11585] Traceback (most recent call last):
[Tue Nov 26 13:56:41.568538 2019] [wsgi:error] [pid 16:tid 139922] [remote 203.109.87.98:11585]   File "/var/www/project_folder/project_folder/wsgi.py", line 17, in <module>
[Tue Nov 26 13:56:41.568541 2019] [wsgi:error] [pid 16:tid 139922] [remote 203.109.87.98:11585]     application = get_wsgi_application()
[Tue Nov 26 13:56:41.568546 2019] [wsgi:error] [pid 16:tid 139922] [remote 203.109.87.98:11585]   File "/var/www/projectenv/lib/python3.6/site-packages/django/core/wsgi.py", line 12, in get_wsgi_application
[Tue Nov 26 13:56:41.568549 2019] [wsgi:error] [pid 16:tid 139922] [remote 203.109.87.98:11585]     django.setup(set_prefix=False)
[Tue Nov 26 13:56:41.568553 2019] [wsgi:error] [pid 16:tid 139922] [remote 203.109.87.98:11585]   File "/var/www/projectenv/lib/python3.6/site-packages/django/__init__.py", line 24, in setup
[Tue Nov 26 13:56:41.568555 2019] [wsgi:error] [pid 16:tid 139922] [remote 203.109.87.98:11585]     apps.populate(settings.INSTALLED_APPS)
[Tue Nov 26 13:56:41.568567 2019] [wsgi:error] [pid 16:tid 139922] [remote 203.109.87.98:11585]   File "/var/www/projectenv/lib/python3.6/site-packages/django/apps/registry.py", line 83, in populate
[Tue Nov 26 13:56:41.568570 2019] [wsgi:error] [pid 16:tid 139922] [remote 203.109.87.98:11585]     raise RuntimeError("populate() isn't reentrant")
[Tue Nov 26 13:56:41.568584 2019] [wsgi:error] [pid 16:tid 139922] [remote 203.109.87.98:11585] RuntimeError: populate() isn't reentrant
[Tue Nov 26 14:22:39.970316 2019] [wsgi:error] [pid 16:tid 13992] [remote 203.109.87.98:20553] mod_wsgi (pid=16): Target WSGI script '/var/www/project_folder/project_folder/wsgi.py' cannot be loaded as Python module.
[Tue Nov 26 14:22:39.970357 2019] [wsgi:error] [pid 16:tid 13992] [remote 203.109.87.98:20553] mod_wsgi (pid=16): Exception occurred processing WSGI script '/var/www/project_folder/project_folder/wsgi.py'.
[Tue Nov 26 14:22:39.970445 2019] [wsgi:error] [pid 16:tid 13992] [remote 203.109.87.98:20553] Traceback (most recent call last):
[Tue Nov 26 14:22:39.970469 2019] [wsgi:error] [pid 16:tid 13992] [remote 203.109.87.98:20553]   File "/var/www/project_folder/project_folder/wsgi.py", line 17, in <module>
[Tue Nov 26 14:22:39.970472 2019] [wsgi:error] [pid 16:tid 13992] [remote 203.109.87.98:20553]     application = get_wsgi_application()
[Tue Nov 26 14:22:39.970477 2019] [wsgi:error] [pid 16:tid 13992] [remote 203.109.87.98:20553]   File "/var/www/projectenv/lib/python3.6/site-packages/django/core/wsgi.py", line 12, in get_wsgi_application
[Tue Nov 26 14:22:39.970480 2019] [wsgi:error] [pid 16:tid 13992] [remote 203.109.87.98:20553]     django.setup(set_prefix=False)
[Tue Nov 26 14:22:39.970485 2019] [wsgi:error] [pid 16:tid 13992] [remote 203.109.87.98:20553]   File "/var/www/projectenv/lib/python3.6/site-packages/django/__init__.py", line 24, in setup
[Tue Nov 26 14:22:39.970488 2019] [wsgi:error] [pid 16:tid 13992] [remote 203.109.87.98:20553]     apps.populate(settings.INSTALLED_APPS)
[Tue Nov 26 14:22:39.970492 2019] [wsgi:error] [pid 16:tid 13992] [remote 203.109.87.98:20553]   File "/var/www/projectenv/lib/python3.6/site-packages/django/apps/registry.py", line 83, in populate
[Tue Nov 26 14:22:39.970495 2019] [wsgi:error] [pid 16:tid 13992] [remote 203.109.87.98:20553]     raise RuntimeError("populate() isn't reentrant")
[Tue Nov 26 14:22:39.970506 2019] [wsgi:error] [pid 16:tid 13992] [remote 203.109.87.98:20553] RuntimeError: populate() isn't reentrant
[Tue Nov 26 14:22:41.118668 2019] [wsgi:error] [pid 16:tid 139922] [remote 203.109.87.98:11585] mod_wsgi (pid=16): Target WSGI script '/var/www/project_folder/project_folder/wsgi.py' cannot be loaded as Python module.
[Tue Nov 26 14:22:41.118693 2019] [wsgi:error] [pid 16:tid 139922] [remote 203.109.87.98:11585] mod_wsgi (pid=16): Exception occurred processing WSGI script '/var/www/project_folder/project_folder/wsgi.py'.
[Tue Nov 26 14:22:41.118759 2019] [wsgi:error] [pid 16:tid 139922] [remote 203.109.87.98:11585] Traceback (most recent call last):
[Tue Nov 26 14:22:41.118780 2019] [wsgi:error] [pid 16:tid 139922] [remote 203.109.87.98:11585]   File "/var/www/project_folder/project_folder/wsgi.py", line 17, in <module>
[Tue Nov 26 14:22:41.118783 2019] [wsgi:error] [pid 16:tid 139922] [remote 203.109.87.98:11585]     application = get_wsgi_application()
[Tue Nov 26 14:22:41.118788 2019] [wsgi:error] [pid 16:tid 139922] [remote 203.109.87.98:11585]   File "/var/www/projectenv/lib/python3.6/site-packages/django/core/wsgi.py", line 12, in get_wsgi_application
[Tue Nov 26 14:22:41.118791 2019] [wsgi:error] [pid 16:tid 139922] [remote 203.109.87.98:11585]     django.setup(set_prefix=False)
[Tue Nov 26 14:22:41.118795 2019] [wsgi:error] [pid 16:tid 139922] [remote 203.109.87.98:11585]   File "/var/www/projectenv/lib/python3.6/site-packages/django/__init__.py", line 24, in setup
[Tue Nov 26 14:22:41.118805 2019] [wsgi:error] [pid 16:tid 139922] [remote 203.109.87.98:11585]     apps.populate(settings.INSTALLED_APPS)
[Tue Nov 26 14:22:41.118809 2019] [wsgi:error] [pid 16:tid 139922] [remote 203.109.87.98:11585]   File "/var/www/projectenv/lib/python3.6/site-packages/django/apps/registry.py", line 83, in populate
[Tue Nov 26 14:22:41.118812 2019] [wsgi:error] [pid 16:tid 139922] [remote 203.109.87.98:11585]     raise RuntimeError("populate() isn't reentrant")
[Tue Nov 26 14:22:41.118822 2019] [wsgi:error] [pid 16:tid 139922] [remote 203.109.87.98:11585] RuntimeError: populate() isn't reentrant


Does anyone have a resolution for this?

Thanks in advance

Graham Dumpleton

unread,
Nov 26, 2019, 2:09:37 PM11/26/19
to mod...@googlegroups.com
The error about populate() is a secondary error message. You must go back in the log and find the very first error message that occurred after the process started to find out the cause.

If you are using mod_wsgi daemon mode (recommended) and this turns out to be caused by a transient issue, such as the database wasn't available, you can configure mod_wsgi to automatically recover by using the startup-timeout option to WSGIDaemonProcess. Set it to a value of '15'. See:

--
You received this message because you are subscribed to the Google Groups "modwsgi" group.
To unsubscribe from this group and stop receiving emails from it, send an email to modwsgi+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/modwsgi/a6847a58-a5c0-4302-9e25-65fd87b67985%40googlegroups.com.

Reply all
Reply to author
Forward
0 new messages