Skip to main content

A utility to create per-user, per-host configuration files for Django.

Project description

A tool for helping with override Django configs.

django_confighelper on its own creates a config for the current django instance based on the current hostname, the current name of the effective uid and the current directory in which the django instance is sitting:

config/hostname/euidname__dirname.py

If the config already exists django_confighelper exits with a warning.

The ‘edit’ subcommand attempts to start a system editor on the config. It first tries the environment variable $EDITOR and then switches to “editor” from the execution path.

The ‘print’ subcommand prints the filename of the config file. This is so you can script further interactions, for example:

echo “CONFIG_SPECIAL=True” >> $(django_confighelper print)

The ‘default’ subcommand looks for a default config file in config/defaults/$user.py and if it exists, it creates a config using the values contained there in. It opens the newly created file just in case you need to change some values - like FRONTEND_PORT e.t.c

The ‘printval’ subcommand prints the value of a DJANGO config setting after the config has been applied. For example:

django_confighelper printval DATABASE_HOST

prints out the setting of the database host.

The ‘updatesettings’ subcommand appends the contents of configdir/templates.py to the end of the settings.py in the current directory. This is required to be run once (and once only), and simply adds some import statements to handle the additional import of per-instance settings files.

confignginx is also included. This is a management command you can use to generate Nginx configs from your Django app.

./manage.py confignginx –port=8100 –domain=www.example.com

will generare an nginx config that will proxy requests to the port but send all static data to the STATIC_ROOT via the STATIC_URL.

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

django_configdir-0.1.7.tar.gz (6.2 kB view details)

Uploaded Source

File details

Details for the file django_configdir-0.1.7.tar.gz.

File metadata

File hashes

Hashes for django_configdir-0.1.7.tar.gz
Algorithm Hash digest
SHA256 2b98c2e4da5e49a0c79b262ababb002c34bb4b298c545944e5ebb72676756af7
MD5 c4127c994b9a3b3c50b22dd77a9e209c
BLAKE2b-256 db51029c225f22013b7b897de23b1dd27ec98b68595aa5516f01943688744514

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