Search code examples
pythondjangogunicornwsgi

Gunicorn with django giving 500 with no extra information


I am trying to run django 3.2.16 with gunicorn, I get this output in console:

[2023-01-15 23:45:39 +0100] [210935] [INFO] Starting gunicorn 20.1.0
[2023-01-15 23:45:39 +0100] [210935] [DEBUG] Arbiter booted
[2023-01-15 23:45:39 +0100] [210935] [INFO] Listening at: http://0.0.0.0:8000 (210935)
[2023-01-15 23:45:39 +0100] [210935] [INFO] Using worker: sync
[2023-01-15 23:45:39 +0100] [210936] [INFO] Booting worker with pid: 210936
[2023-01-15 23:45:39 +0100] [210935] [DEBUG] 1 workers

Everything looks like working, but when I go to localhost, I get Internal Server Error.

It kinda behaves like if I had DEBUG = False, but I have DEBUG = True and there is also nothing in console. Django setup finishes and I also verify, that settings.DEBUG is indded true:

My wsgi.py file:

application = get_wsgi_application()
print(settings.DEBUG)

And of course runserver works fine.

What else could that be? How to get some kind of error output? I tried capture-out and all the log files and levels that gunicorn provides but got nothing useful from the console.


Solution

  • The reason was this line in my django log settings:

            "disable_existing_loggers": True,
    

    Setting this to False fixed my problem.