mirror of
https://github.com/HackSoftware/Django-Styleguide.git
synced 2025-04-29 04:33:46 +03:00
Add a sub-section about env prefixing
This commit is contained in:
parent
f88c892296
commit
cd7712e41e
|
@ -38,6 +38,7 @@ Django styleguide that we use in [HackSoft](https://hacksoft.io).
|
||||||
* [Advanced serialization](#advanced-serialization)
|
* [Advanced serialization](#advanced-serialization)
|
||||||
- [Urls](#urls)
|
- [Urls](#urls)
|
||||||
- [Settings](#settings)
|
- [Settings](#settings)
|
||||||
|
* [Prefixing environment variables with `DJANGO_`](#prefixing-environment-variables-with-django_)
|
||||||
* [Integrations](#integrations)
|
* [Integrations](#integrations)
|
||||||
* [Reading from `.env`](#reading-from-env)
|
* [Reading from `.env`](#reading-from-env)
|
||||||
- [Errors & Exception Handling](#errors--exception-handling)
|
- [Errors & Exception Handling](#errors--exception-handling)
|
||||||
|
@ -1094,6 +1095,14 @@ from config.settings.celery import * # noqa
|
||||||
from config.settings.sentry 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
|
### 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:
|
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:
|
||||||
|
|
Loading…
Reference in New Issue
Block a user