move some settings to environment variables
This commit is contained in:
parent
9d859f4ffc
commit
c0bdfed79c
20
README.md
20
README.md
|
@ -13,14 +13,28 @@ inventory over my various servers and other network equipment.
|
||||||
in the future and SQlite is not supported for production.
|
in the future and SQlite is not supported for production.
|
||||||
|
|
||||||
### Local Setup
|
### Local Setup
|
||||||
3. Run `make local` to create the virtual environment for developemenet
|
3. Run `make local` to create the virtual environment for development.
|
||||||
http://localhost:8000 . You're now all set to start developing.
|
You're now all set to start developing.
|
||||||
|
|
||||||
### Docker Setup
|
### Docker Setup
|
||||||
3. Run `make` to start the development server. You can access it
|
3. Run `make` to start the development server. You can access it
|
||||||
at http://localhost:8000 . You're now all set to start developing. \
|
at http://localhost:8000 . You're now all set to start developing. \
|
||||||
If you need to run migrations you can simply restart the Docker container.
|
If you need to run migrations you can simply restart the Docker container.
|
||||||
|
|
||||||
|
#### Environment Variables
|
||||||
|
|
||||||
|
To customise the application in the Docker container you can use environment
|
||||||
|
variables in the docker-compose.yml file. Currently the following variables are
|
||||||
|
supported.
|
||||||
|
|
||||||
|
- **DJANGO_SECRET_KEY** the secret key is mandatory, otherwise the application
|
||||||
|
doesn't run. Make sure that it is some long random string.
|
||||||
|
- **DJANGO_DEBUG** settings this variable to any value enables the Django debug
|
||||||
|
mode. Make sure that you don't set it on a production server.
|
||||||
|
- **DJANGO_SETTINGS_MODULE** the path to the settings file to use in the
|
||||||
|
container. This requires a dotet syntax. The default is
|
||||||
|
`network_inventory.settings.docker`.
|
||||||
|
|
||||||
## Todos
|
## Todos
|
||||||
- [ ] Create an Apache configuration
|
- [ ] Create an Apache configuration
|
||||||
- [ ] configure htaccess or something similar
|
- [ ] configure htaccess or something similar
|
||||||
|
@ -53,4 +67,4 @@ inventory over my various servers and other network equipment.
|
||||||
## Developemenet
|
## Developemenet
|
||||||
|
|
||||||
For a detailed documentation of the source have a look at the
|
For a detailed documentation of the source have a look at the
|
||||||
[documentation](https://git.2li.ch/Nebucatnetzer/network_inventory/src/branch/master/docs/docs.org).
|
[documentation](https://git.2li.ch/Nebucatnetzer/network_inventory/src/branch/master/docs/docs.org).
|
||||||
|
|
|
@ -19,8 +19,8 @@ services:
|
||||||
ports:
|
ports:
|
||||||
- "8000:8000"
|
- "8000:8000"
|
||||||
environment:
|
environment:
|
||||||
- DEBUG=False
|
|
||||||
- DJANGO_SETTINGS_MODULE=network_inventory.settings.docker
|
- DJANGO_SETTINGS_MODULE=network_inventory.settings.docker
|
||||||
- SECRET_KEY=developemenet_key
|
- DJANGO_DEBUG=True
|
||||||
|
- DJANGO_SECRET_KEY=foo
|
||||||
depends_on:
|
depends_on:
|
||||||
- db
|
- db
|
||||||
|
|
|
@ -5,10 +5,11 @@ ALLOWED_HOSTS = [
|
||||||
'127.0.0.1',
|
'127.0.0.1',
|
||||||
]
|
]
|
||||||
|
|
||||||
DEBUG = True
|
|
||||||
|
|
||||||
# SECURITY WARNING: keep the secret key used in production secret!
|
# SECURITY WARNING: keep the secret key used in production secret!
|
||||||
SECRET_KEY = os.getenv('SECRET_KEY')
|
SECRET_KEY = os.environ.get('DJANGO_SECRET_KEY')
|
||||||
|
|
||||||
|
DEBUG = os.environ.get('DJANGO_DEBUG')
|
||||||
|
|
||||||
DATABASES = {
|
DATABASES = {
|
||||||
'default': {
|
'default': {
|
||||||
|
|
Loading…
Reference in New Issue