mirror of https://github.com/snachodog/mybuddy.git
Add environment variable-based settings and configuration documentation.
This commit is contained in:
parent
f12ba2bf14
commit
dd4455178a
57
README.md
57
README.md
|
@ -22,6 +22,7 @@ work.
|
|||
- [Nanobox](#nanobox)
|
||||
- [Heroku](#heroku)
|
||||
- [Manual](#manual)
|
||||
- [Configuration](#configuration)
|
||||
- [Development](#development)
|
||||
- [Installation](#installation)
|
||||
- [Fake data](#fake-data)
|
||||
|
@ -64,7 +65,7 @@ for detailed information.
|
|||
|
||||
1. Initialize the Elastic Bean application (using the IAM user from the previous step)
|
||||
|
||||
eb init
|
||||
eb init -p python-3.6
|
||||
|
||||
1. Create/deploy the environment! :rocket:
|
||||
|
||||
|
@ -265,6 +266,60 @@ Python 3.x, nginx, uwsgi and sqlite and should be sufficient for a few users
|
|||
|
||||
1. That's it (hopefully)! :tada:
|
||||
|
||||
## Configuration
|
||||
|
||||
Environment variables can be use to set a number of configuration settings:
|
||||
|
||||
### `ALLOWED_HOSTS`
|
||||
|
||||
Default: *
|
||||
|
||||
This option may be set a single host or comma-separated list of hosts (without
|
||||
spaces). This should *always* be set accurately for production deployments.
|
||||
|
||||
See also: [Django's documentation on the ALLOWED_HOSTS setting](https://docs.djangoproject.com/en/1.11/ref/settings/#allowed-hosts)
|
||||
|
||||
### `ALLOW_UPLOADS`
|
||||
|
||||
Default: True
|
||||
|
||||
Whether or not to allow uploads (e.g. of Child photos). For some deployments
|
||||
(AWS, Heroku, Nanobox) this setting will actually default to False.
|
||||
|
||||
### `DEBUG`
|
||||
|
||||
Default: False
|
||||
|
||||
See [Django's documentation on the DEBUG setting](https://docs.djangoproject.com/en/1.11/ref/settings/#debug).
|
||||
|
||||
### `NAP_START_MAX`
|
||||
|
||||
Default: 18:00
|
||||
|
||||
The maximum *start* time (in the application's time zone) before which a sleep
|
||||
entry is consider a nap. Expects the format %H:%M.
|
||||
|
||||
### `NAP_START_MIN`
|
||||
|
||||
Default: 06:00
|
||||
|
||||
The minimum *start* time (in the application's time zone) after which a sleep
|
||||
entry is considered a nap. Expects the format %H:%M.
|
||||
|
||||
### `SECRET_KEY`
|
||||
|
||||
Default: None
|
||||
|
||||
See [Django's documentation on the SECRET_KEY setting](https://docs.djangoproject.com/en/1.11/ref/settings/#secret-key).
|
||||
|
||||
|
||||
### `TIME_ZONE`
|
||||
|
||||
Default: Etc/UTC
|
||||
|
||||
The time zone to use for the application. See [List of tz database time zones](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones)
|
||||
for all available settings.
|
||||
|
||||
## Development
|
||||
|
||||
### Installation
|
||||
|
|
|
@ -10,9 +10,11 @@ BASE_DIR = os.path.dirname(
|
|||
)
|
||||
|
||||
|
||||
# SECURITY WARNING: set this to your domain name in production!
|
||||
# Required settings
|
||||
|
||||
ALLOWED_HOSTS = ['*']
|
||||
ALLOWED_HOSTS = os.environ.get('ALLOWED_HOSTS', '*').split(',')
|
||||
SECRET_KEY = os.environ.get('SECRET_KEY', None)
|
||||
DEBUG = os.environ.get('DEBUG', False)
|
||||
|
||||
|
||||
# Applications
|
||||
|
@ -102,7 +104,7 @@ LOGOUT_REDIRECT_URL = '/login/'
|
|||
|
||||
LANGUAGE_CODE = 'en-us'
|
||||
|
||||
TIME_ZONE = 'America/New_York'
|
||||
TIME_ZONE = os.environ.get('TIME_ZONE', 'Etc/UTC')
|
||||
|
||||
USE_I18N = True
|
||||
|
||||
|
@ -131,7 +133,7 @@ MEDIA_ROOT = os.path.join(BASE_DIR, 'media')
|
|||
|
||||
WHITENOISE_ROOT = os.path.join(BASE_DIR, 'static', 'root')
|
||||
|
||||
ALLOW_UPLOADS = True
|
||||
ALLOW_UPLOADS = os.environ.get('ALLOW_UPLOADS', True)
|
||||
|
||||
|
||||
# Django Rest Framework
|
||||
|
@ -153,10 +155,9 @@ REST_FRAMEWORK = {
|
|||
}
|
||||
|
||||
# Baby Buddy configuration
|
||||
# See README.md#configuration for details about these settings.
|
||||
|
||||
BABY_BUDDY = {
|
||||
# A sleep entry with a start time between NAP_START_MIN and NAP_START_MAX
|
||||
# (in the current TZ) will be categorized as a nap. Use the format %H:%M.
|
||||
'NAP_START_MIN': '06:00',
|
||||
'NAP_START_MAX': '18:00'
|
||||
'NAP_START_MIN': os.environ.get('NAP_START_MIN', '06:00'),
|
||||
'NAP_START_MAX': os.environ.get('NAP_START_MAX', '18:00')
|
||||
}
|
||||
|
|
|
@ -5,12 +5,6 @@ from .base import *
|
|||
|
||||
SECRET_KEY = 'CHANGE ME'
|
||||
DEBUG = True
|
||||
INTERNAL_IPS = (
|
||||
'0.0.0.0',
|
||||
'127.0.0.1',
|
||||
)
|
||||
|
||||
ALLOW_UPLOADS = True
|
||||
|
||||
|
||||
# Database
|
||||
|
|
|
@ -1,18 +1,6 @@
|
|||
import os
|
||||
|
||||
from .base import * # noqa: F401,F403
|
||||
|
||||
|
||||
# Production settings
|
||||
# See babybuddy.settings.base for additional settings information.
|
||||
|
||||
SECRET_KEY = os.environ.get('SECRET_KEY')
|
||||
|
||||
ALLOWED_HOSTS = os.environ.get('ALLOWED_HOSTS', '').split(',')
|
||||
|
||||
DEBUG = os.environ.get('DEBUG', False)
|
||||
|
||||
|
||||
# Database
|
||||
# https://docs.djangoproject.com/en/1.11/ref/settings/#databases
|
||||
|
||||
|
|
|
@ -3,15 +3,7 @@ import os
|
|||
from .base import * # noqa: F401,F403
|
||||
|
||||
|
||||
DEBUG = os.environ.get('DEBUG', False)
|
||||
|
||||
|
||||
ALLOW_UPLOADS = False
|
||||
|
||||
|
||||
# SECURITY WARNING: keep the secret key used in production secret!
|
||||
|
||||
SECRET_KEY = os.environ['SECRET_KEY']
|
||||
ALLOW_UPLOADS = os.environ.get('ALLOW_UPLOADS', False)
|
||||
|
||||
|
||||
# Database
|
||||
|
|
|
@ -5,15 +5,7 @@ import dj_database_url
|
|||
from .base import * # noqa: F401,F403
|
||||
|
||||
|
||||
DEBUG = os.environ.get('DEBUG', False)
|
||||
|
||||
|
||||
ALLOW_UPLOADS = False
|
||||
|
||||
|
||||
# SECURITY WARNING: keep the secret key used in production secret!
|
||||
|
||||
SECRET_KEY = os.environ['SECRET_KEY']
|
||||
ALLOW_UPLOADS = os.environ.get('ALLOW_UPLOADS', False)
|
||||
|
||||
|
||||
# Database
|
||||
|
|
|
@ -3,17 +3,6 @@ import os
|
|||
from .base import * # noqa: F401,F403
|
||||
|
||||
|
||||
DEBUG = os.environ.get('DEBUG', False)
|
||||
|
||||
|
||||
ALLOW_UPLOADS = False
|
||||
|
||||
|
||||
# SECURITY WARNING: keep the secret key used in production secret!
|
||||
|
||||
SECRET_KEY = os.environ['SECRET_KEY']
|
||||
|
||||
|
||||
# Database
|
||||
# https://docs.djangoproject.com/en/1.11/ref/settings/#databases
|
||||
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
# See README.md#configuration for other configuration options.
|
||||
|
||||
ALLOWED_HOSTS=
|
||||
DEBUG=False
|
||||
DJANGO_SETTINGS_MODULE=babybuddy.settings.docker
|
||||
|
|
Loading…
Reference in New Issue