1

I'm facing an error while trying to deploy my django app through Elastic Beanstalk service. Locally everything works correctly.

I also try to modify my code based on answers Django stops working with RuntimeError: populate() isn't reentrant and this Target WSGI script '/opt/python/current/app/ … /wsgi.py' cannot be loaded as Python module without success.

 [:error] [pid 3519] mod_wsgi (pid=3519): Target WSGI script '/opt/python/current/app/diamond/wsgi.py' cannot be loaded as Python module.
 [:error] [pid 3519] mod_wsgi (pid=3519): Exception occurred processing WSGI script '/opt/python/current/app/diamond/wsgi.py'.
 [:error] [pid 3519] Traceback (most recent call last):
 [:error] [pid 3519]   File "/opt/python/current/app/diamond/wsgi.py", line 16, in <module>
 [:error] [pid 3519]     application = get_wsgi_application()
 [:error] [pid 3519]   File "/opt/python/run/venv/local/lib/python3.4/site-packages/django/core/wsgi.py", line 12, in get_wsgi_application
 [:error] [pid 3519]     django.setup(set_prefix=False)
 [:error] [pid 3519]   File "/opt/python/run/venv/local/lib/python3.4/site-packages/django/__init__.py", line 24, in setup
 [:error] [pid 3519]    apps.populate(settings.INSTALLED_APPS)
 [:error] [pid 3519]   File "/opt/python/run/venv/local/lib/python3.4/site-packages/django/apps/registry.py", line 81, in populate
 [:error] [pid 3519]     raise RuntimeError("populate() isn't reentrant")
 [:error] [pid 3519] RuntimeError: populate() isn't reentrant

Moreover my wsgi.py file :

import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "diamond.settings")

application = get_wsgi_application()

and my django.config included into

option_settings:
  aws:elasticbeanstalk:container:python:
    WSGIPath: diamond/wsgi.py

Thanks in advance

Graham Dumpleton
  • 57,726
  • 6
  • 119
  • 134
  • 1
    That error is not the root cause error. Find the very first error from the first request made against the new process. The error you give is from subsequent requests due to Django failing in a different way on subsequent requests. – Graham Dumpleton Apr 25 '18 at 21:01
  • You are right @GrahamDumpleton i checked my log file and the problem was in Pillow installation from `requirements.txt`. If you would like to answer as an official answer i will accept it. – Panos Angelopoulos Apr 26 '18 at 08:04

0 Answers0