pakal / django-compat-patcher

A system to improve compatibility between different Django versions, and make upgrading dependencies less painful.
MIT License
13 stars 2 forks source link

RuntimeError: populate() isn't reentrant #9

Closed jayvdb closed 2 years ago

jayvdb commented 4 years ago

I guess this is caused by a second invocation of django.setup(), but it might also be an extra safety check added in latter Django

Traceback (most recent call last):
  File "/home/abuild/rpmbuild/BUILD/django-app-helper-2.2.2/app_helper/tests/test_commands.py", line 619, in test_testrun_persistent_path
    core(args, self.application)
  File "/home/abuild/rpmbuild/BUILD/django-app-helper-2.2.2/app_helper/main.py", line 355, in core
    _make_settings(args, application, settings, STATIC_ROOT, MEDIA_ROOT)
  File "/home/abuild/rpmbuild/BUILD/django-app-helper-2.2.2/app_helper/utils.py", line 326, in _make_settings
    django.setup()
  File "/usr/lib/python3.8/site-packages/django/__init__.py", line 24, in setup
    apps.populate(settings.INSTALLED_APPS)
  File "/usr/lib/python3.8/site-packages/django/apps/registry.py", line 83, in populate
    raise RuntimeError("populate() isn't reentrant")
RuntimeError: populate() isn't reentrant
pakal commented 4 years ago

Hm weird, Django has had for a while some code preventing duplicate execution of populate(). So in case of double setup() call, populate() just exits silently. This error above might happen but only in case of real "reentrancy", which doesn't appear in this traceback.

What version of Django does this appear with, exactly ?