From cd7712e41e39383d5f8027b8fb721e7e149c2336 Mon Sep 17 00:00:00 2001 From: Radoslav Georgiev Date: Mon, 22 Nov 2021 14:31:06 +0200 Subject: [PATCH] Add a sub-section about env prefixing --- README.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/README.md b/README.md index fb0e0b6..5eb0959 100644 --- a/README.md +++ b/README.md @@ -38,6 +38,7 @@ Django styleguide that we use in [HackSoft](https://hacksoft.io). * [Advanced serialization](#advanced-serialization) - [Urls](#urls) - [Settings](#settings) + * [Prefixing environment variables with `DJANGO_`](#prefixing-environment-variables-with-django_) * [Integrations](#integrations) * [Reading from `.env`](#reading-from-env) - [Errors & Exception Handling](#errors--exception-handling) @@ -1094,6 +1095,14 @@ from config.settings.celery import * # noqa from config.settings.sentry import * # noqa ``` +### Prefixing environment variables with `DJANGO_` + +In a lot of examples, you'll see that environment variables are usually prefixed with `DJANGO_`. This is very helpful when there are other applications running alongside your Django app & reading from the same environment. + +We tend to prefix with `DJANGO_` only `DJANGO_SETTINGS_MODULE` and `DJANGO_DEBUG` & not prefix everything else. + +This is mostly up to personal preference. **Just make sure you are consistent with that.** + ### Integrations Since everything should be imported in `base.py`, but sometimes we don't want to configure a certain integration for local development, we derived the following approach: