Move env variables to envfile
This commit is contained in:
parent
79fc7413c9
commit
7d23ee6044
4 changed files with 23 additions and 20 deletions
|
@ -12,9 +12,6 @@ https://docs.djangoproject.com/en/3.0/ref/settings/
|
|||
|
||||
import os
|
||||
|
||||
from django.core.exceptions import ImproperlyConfigured
|
||||
|
||||
|
||||
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
|
||||
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
||||
|
||||
|
@ -22,12 +19,12 @@ BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
|||
# See https://docs.djangoproject.com/en/3.0/howto/deployment/checklist/
|
||||
|
||||
# SECURITY WARNING: keep the secret key used in production secret!
|
||||
SECRET_KEY = '2r@t7^g4-@980!oo-v!1+wj+0o^s&m(+yyyt#2&k2e!ao*b$g5'
|
||||
SECRET_KEY = os.getenv('SECRET_KEY', '2r@t7^g4-@980!oo-v!1+wj+0o^s&m(+yyyt#2&k2e!ao*b$g5')
|
||||
|
||||
# SECURITY WARNING: don't run with debug turned on in production!
|
||||
DEBUG = True
|
||||
DEBUG = os.getenv('DEBUG', '1') == '1'
|
||||
|
||||
ALLOWED_HOSTS = []
|
||||
ALLOWED_HOSTS = os.getenv('ALLOWED_HOSTS', '').split(',')
|
||||
|
||||
# Application definition
|
||||
|
||||
|
|
|
@ -4,10 +4,8 @@ services:
|
|||
build: .
|
||||
ports:
|
||||
- "8000:8000"
|
||||
environment:
|
||||
DATABASE_HOST: 'database'
|
||||
CELERY_BROKER: 'redis://redis:6379/0'
|
||||
CELERY_BACKEND: 'redis://redis:6379/1'
|
||||
env_file: 'web.env'
|
||||
restart: on-failure
|
||||
depends_on:
|
||||
- database
|
||||
command: >
|
||||
|
@ -17,10 +15,8 @@ services:
|
|||
|
||||
celery-worker:
|
||||
build: .
|
||||
environment:
|
||||
DATABASE_HOST: 'database'
|
||||
CELERY_BROKER: 'redis://redis:6379/0'
|
||||
CELERY_BACKEND: 'redis://redis:6379/1'
|
||||
env_file: 'web.env'
|
||||
restart: on-failure
|
||||
depends_on:
|
||||
- web
|
||||
- redis
|
||||
|
@ -30,10 +26,8 @@ services:
|
|||
|
||||
celery-beat:
|
||||
build: .
|
||||
environment:
|
||||
DATABASE_HOST: 'database'
|
||||
CELERY_BROKER: 'redis://redis:6379/0'
|
||||
CELERY_BACKEND: 'redis://redis:6379/1'
|
||||
env_file: 'web.env'
|
||||
restart: on-failure
|
||||
depends_on:
|
||||
- web
|
||||
- redis
|
||||
|
@ -47,6 +41,7 @@ services:
|
|||
# Db stuff
|
||||
database:
|
||||
image: mariadb:10.5.4-focal
|
||||
restart: on-failure
|
||||
environment:
|
||||
MYSQL_ROOT_PASSWORD: example
|
||||
MYSQL_DATABASE: kers
|
||||
|
|
|
@ -23,7 +23,7 @@ class UserMetaForm(ModelForm):
|
|||
fields = ['real_name', 'student_number']
|
||||
widgets = {
|
||||
'real_name': TextInput(attrs={'placeholder': 'Robbe Van Herck'}),
|
||||
'student_number': TextInput(attrs={'placeholder': '01701111'})
|
||||
'student_number': TextInput(attrs={'placeholder': '001700000', 'pattern': '[0-9]*'})
|
||||
}
|
||||
|
||||
|
||||
|
|
11
web.env
Normal file
11
web.env
Normal file
|
@ -0,0 +1,11 @@
|
|||
DATABASE_HOST=database
|
||||
CELERY_BROKER=redis://redis:6379/0
|
||||
CELERY_BACKEND=redis://redis:6379/1
|
||||
SECRET_KEY=REPLACEME
|
||||
DEBUG=1
|
||||
SERVER_URL=http://localhost:8000
|
||||
OAUTH_CLIENT_ID=REPLACEME
|
||||
OAUTH_CLIENT_SECRET=REPLACEME
|
||||
KERS_ADMIN_USERNAME=replaceme
|
||||
KERS_ADMIN_PASSWORD=replaceme
|
||||
ALLOWED_HOSTS=localhost
|
Loading…
Reference in a new issue