Gunicorn: Gunicorn conf file, environment variables syntax

Created on 27 Feb 2017  路  4Comments  路  Source: benoitc/gunicorn

Hello,
In the documentation, it is written that there is no special syntax for config, but I don't understand how to use the env parameter to pass multiple values.

Should I use a dictionary to pass multiple values?

For instance I would like to pass environment variables in gunicorn processes, my gunicorn_config.py file is:

bind = "127.0.0.1:8887"
log_file = "path/to/logs/gunicorn_logs.txt"
workers = 3

# Environment variables
env = {
    "DJANGO_SECRET_KEY": "something",
    "OTHER_SECRET": "something_else"
    }

But it doesn't work. Is my syntax right?
Thanks in advance

Question Documentation - Forum -

Most helpful comment

Ok, in found it:

# Environment variables
raw_env = [
    "DJANGO_SECRET_KEY=something",
    "OTHER_SECRET=something_else"
    ]

All 4 comments

Ok, in found it:

# Environment variables
raw_env = [
    "DJANGO_SECRET_KEY=something",
    "OTHER_SECRET=something_else"
    ]

ok, closing the issue since you found it :)

Hello, I was stuck on this exact issue today, because I used the example which is not up to date with the latest docs. Thanks to this issue, I could find raw_env though 馃槈

@alexprengere I've just added an example to examples/example_config.py in https://github.com/benoitc/gunicorn/commit/01a1c7ca9a76d14a707b2946192ca7278247c2ce.

Was this page helpful?
0 / 5 - 0 ratings