diff --git a/README.md b/README.md index 150df5e..bb4fb0f 100644 --- a/README.md +++ b/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. ### Local Setup -3. Run `make local` to create the virtual environment for developemenet - http://localhost:8000 . You're now all set to start developing. +3. Run `make local` to create the virtual environment for development. + You're now all set to start developing. ### Docker Setup 3. Run `make` to start the development server. You can access it 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. +#### 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 - [ ] Create an Apache configuration - [ ] configure htaccess or something similar @@ -53,4 +67,4 @@ inventory over my various servers and other network equipment. ## Developemenet 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). \ No newline at end of file +[documentation](https://git.2li.ch/Nebucatnetzer/network_inventory/src/branch/master/docs/docs.org). diff --git a/docker-compose.yml b/docker-compose.yml index ee5decf..6278005 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -19,8 +19,8 @@ services: ports: - "8000:8000" environment: - - DEBUG=False - DJANGO_SETTINGS_MODULE=network_inventory.settings.docker - - SECRET_KEY=developemenet_key + - DJANGO_DEBUG=True + - DJANGO_SECRET_KEY=foo depends_on: - db diff --git a/network_inventory/network_inventory/settings/docker.py b/network_inventory/network_inventory/settings/docker.py index 2daad20..ac2cac3 100644 --- a/network_inventory/network_inventory/settings/docker.py +++ b/network_inventory/network_inventory/settings/docker.py @@ -5,10 +5,11 @@ ALLOWED_HOSTS = [ '127.0.0.1', ] -DEBUG = True # 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 = { 'default': {