Django populate() isn't reentrant

后端 未结 6 1954
一生所求
一生所求 2020-11-29 07:54

I keep getting this when I try to load my Django application on production . I tried all the stackoverflow answers but nothing has fixed it. Any other ideas. (I\'m usin

6条回答
  •  伪装坚强ぢ
    2020-11-29 08:48

    This RuntimeError first occured for me after upgrading to Django 1.7 (and still is present with Django 1.8). It is usually caused by an Django application which raises an error, but that error is swallowed somehow.

    Here's a workaround which works for me. Add it to your wsgi.py and the real error should be logged:

    import os
    import time
    import traceback
    import signal
    import sys
    from django.core.wsgi import get_wsgi_application
    
    try:
        application = get_wsgi_application()
        print 'WSGI without exception'
    except Exception:
        print 'handling WSGI exception'
        # Error loading applications
        if 'mod_wsgi' in sys.modules:
            traceback.print_exc()
            os.kill(os.getpid(), signal.SIGINT)
            time.sleep(2.5)
    

    See this thread on modwsgi for more details.

提交回复
热议问题