from base.settings import *  # noqa

import os
import random
import string

if not os.path.exists('/tmp/django_secret'):
    with open('/tmp/django_secret', 'w') as handle:
        handle.write("".join([random.SystemRandom().choice(string.digits + string.punctuation) for i in range(100)]))

with open('/tmp/django_secret', 'r') as handle:
    SECRET_KEY = handle.read()

DEBUG = os.environ.get('DJANGO_DEBUG', None) == 'True'

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.postgresql',
        'NAME': os.environ.get('PGDATABASE', 'postgres'),
        'USER': os.environ.get('PGUSER', 'postgres'),
        'PASSWORD': os.environ.get('PGPASSWORD', 'postgres'),
        'HOST': os.environ.get('PGHOST', 'db'),
        'PORT': os.environ.get('PGPORT', '5432'),
    }
}

@@ -419,16 +419,80 @@
 = 'True'
+%0AALLOWED_HOSTS = os.environ.get('ALLOWED_HOSTS', '*').split(',')
 %0A%0ADATABA

add allowed hosts