Search code examples
pythongunicorn

Gunicorn preload config parameter not working


My config.py file for gunicorn looks like that:

preload = True
loglevel = "debug"

I run gunicorn with the following command:

gunicorn -c config.py --bind 0.0.0.0:1234 app.index:server

The log looks like this:

service   |      preload: False

Why is the preload parameter not showing up in the config print out when starting?


Solution

  • Short answer: because of a typo: preload_app is correct, not preload.

    Longer answer: While in the command line, the preload parameter is --preload, in the config.py it needs to be called preload_app instead of preload:

    preload_app = True
    

    Now the log looks as expected:

    service   |      preload: True