Skip to main content

Configure gunicorn completely via environment variables

Project description

gunicorn_environmentconfig

Configure gunicorn completely via environment variables.

gunicorn itself provides environment variable access to only some of its settings. This package closes the gap, and allows configuring all settings via the environment.

Usage

Put this into your config file (usually gunicorn.conf.py):

import gunicorn_environmentconfig
gunicorn_environmentconfig.apply(globals())

Set environment variables with the naming scheme gunicorn.{setting}, where setting is the name you'd use in the config file, for example:

env gunicorn.preload_app=true python -m gunicorn myapp

If you append __literal__ to the variable name, they are evaluated as Python literals, for example to make gunicorn use the already existing logging configuration (which might e.g. use a JSON formatter) and not set up its own formatters, use this:

gunicorn.logconfig_dict__literal__={'root': {}, 'loggers': {'gunicorn.error': {'propagate': True}}, 'handlers': {}, 'formatters': {}}

Special case: ini file

To help with transitioning, settings read from a paste.ini configuration file can be added to the environment (environment takes priority).

To use this, set the GUNICORN_INI_CONFIG environment variable to the filename and section name.

[app:main]
use = egg:myapp#main

my_app_setting = value1
gunicorn.preload_app = true
env GUNICORN_INI_CONFIG=paste.ini#app:main python -m gunicorn myapp

gunicorn_environmentconfig Changes

1.0.1 (2023-05-19)

  • ini: Export ini file settings into environment (ini)

1.0.0 (2023-05-17)

  • Initial release (initial)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

gunicorn_environmentconfig-1.0.1.tar.gz (3.4 kB view details)

Uploaded Source

Built Distribution

File details

Details for the file gunicorn_environmentconfig-1.0.1.tar.gz.

File metadata

File hashes

Hashes for gunicorn_environmentconfig-1.0.1.tar.gz
Algorithm Hash digest
SHA256 1955fefdf0f9300f4b3fcade57cea095fd584015eb3255d701cbce9d24381824
MD5 4271679bc0d520819dbf4dd64a3252ac
BLAKE2b-256 8991f3d71a84a51db68c11e597f42bb120748862aaa2f0e6a6cb62f6a2517d9d

See more details on using hashes here.

File details

Details for the file gunicorn_environmentconfig-1.0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for gunicorn_environmentconfig-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 421e83f373e0b4fe633fc02e080ada75df69adae17d417c8ed6a92d8eec59224
MD5 da235103e7bb17410699a14b1c2568e9
BLAKE2b-256 9752c71f2dcc4751c38911b6c1251be1db173c4ae935d0f0d35a1d8fd4d35b61

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page