1

I've had a program that has been running fine for months. I've been trying to install Postfix on the server this morning and suddenly start getting an error on the site. Here is the traceback

mod_wsgi (pid=11948): Target WSGI script '/var/www/zouzoukos/zouzoukos/wsgi.py$
mod_wsgi (pid=11948): Exception occurred processing '/var/www/zouzoukos/zouzoukos/wsgi.py'.
Traceback (most recent call last):
   File "/var/www/zouzoukos/zouzoukos/wsgi.py", line 29, in <module>
     application = get_wsgi_application()
   File "/var/www/zouzoukos/env/lib/python2.7/site-packages/django/core/wsgi.py", line 13, in get_wsgi_application
     django.setup()
   File "/var/www/zouzoukos/env/lib/python2.7/site-packages/django/__init__.py", line 18, in setup
     apps.populate(settings.INSTALLED_APPS)
"/var/www/zouzoukos/env/lib/python2.7/site-packages/django/__init__.py", line 18, in setup
raise RuntimeError("populate() isn't reentrant")
RuntimeError: populate() isn't reentrant

The thing is, I have a couple more versions of the site running for other people and they're still fine (this was the first). I cannot understand what I need to update to get it working again.

I've tried everything in this thread and still nothing

Community
  • 1
  • 1
HenryM
  • 5,557
  • 7
  • 49
  • 105
  • Check your earlier logs. I was getting that due to a problem loading an app 3h earlier than the first time I this error popped up, when some app or something couldn't start because of not enough available memory. – Fabio Sep 21 '16 at 17:05

3 Answers3

1

I tried the approach from @valentjjedi and then I tired manage.py and got a different error indicating a MySQL-python issue so I uninstalled and reinstalled and it worked

env/bin/pip uninstall mysql-python 
env/bin/pip install mysql-python
HenryM
  • 5,557
  • 7
  • 49
  • 105
1

in my case I got this error after deleting an app folder which was still listed in INSTALLED_APPS. After commenting this app from INSTALLED_APPS everything got back to normal.

ditori
  • 21
  • 5
0

This error basically means that something is already tried to mess with app_config ordered dict from Apps class before django was able to setup installed apps properly in first place. Check django.apps.registry.Apps#populate, it sais:

# app_config should be pristine, otherwise the code below won't
# guarantee that the order matches the order in INSTALLED_APPS.
if self.app_configs:
    raise RuntimeError("populate() isn't reentrant")

Try to check what's in this app_config dictionary to get more information. Also just restarting all the things might help.

valignatev
  • 6,020
  • 8
  • 37
  • 61
  • I've tried a `service apache2 reload` and got no difference. How do I check `app_config`? – HenryM Sep 21 '16 at 14:27
  • you go to `/var/www/zouzoukos/env/lib/python2.7/site-packages/django/__init__.py` and print or log `apps.app_config` before calling populate. – valignatev Sep 21 '16 at 14:34