Exemplo n.º 1
0
 def setUp(self):
     super(FileEnvTests, self).setUp()
     Env.ENVIRON = {}
     self.env = Env()
     file_path = Path(__file__, is_file=True)('test_env.txt')
     self.env.read_env(file_path,
                       PATH_VAR=Path(__file__, is_file=True).__root__)
Exemplo n.º 2
0
def member_list(request):
    env = Env()
    MEMBERS_PASSWORD = env('MEMBERS_PASSWORD')

    # handle form submission
    if request.POST:
        pw_form = PasswordForm(request.POST)

        if pw_form.is_valid(
        ) and pw_form.cleaned_data['password'] == MEMBERS_PASSWORD:
            request.session['password'] = pw_form.cleaned_data['password']
            return redirect('members:member_list')

        messages.error(
            request,
            "The password you entered was incorrect, please try again.")

    # form not being submitted, check password
    if (request.session.get('password')
            and request.session['password'] == MEMBERS_PASSWORD):
        member_list = Member.objects.all()
        return render(request, 'members/member_list.html', {
            'member_list': member_list,
        })

    # password is wrong, render form
    pw_form = PasswordForm()
    return render(request, 'members/members_password_form.html', {
        'pw_form': pw_form,
    })
Exemplo n.º 3
0
 def setUp(self):
     self.env = Env()
     self._orig_environ = os.environ
     os.environ = {}
     file_path = Path(__file__, is_file=True)('test_env.txt')
     self.env.read_env(file_path,
                       PATH_VAR=Path(__file__, is_file=True).__root__)
Exemplo n.º 4
0
    def send_sms(cls, from_name, to_name, to_phone, text):
        env = Env()
        client = Client(
            env('ACCOUNT_SID', default='ACd2c4870ba6657809de3fbd55b14647a1'),
            env('AUTH_TOKEN', default='9eaf6fff15d756ab219b9dcc43404129'))

        message = client.messages.create(
            body='\nFrom: {}\nTo: {}\n{}'.format(from_name, to_name, text),
            from_='+13058594740',
            to=to_phone)

        return message.sid
Exemplo n.º 5
0
def test_decrypt_env(monkeypatch):
    monkeypatch.setattr(Env, "ENVIRON", {
        "TEST_VAR": "ok",
        "TEST_DECRYPT": "prefix-{{ key-name }}-data"
    })

    store = MockStore({"key-name": "secret"})

    env = Env()
    resolve_django_environ(env, store)

    assert env.str("TEST_VAR") == "ok"
    assert env.str("TEST_DECRYPT") == "prefix-secret-data"
Exemplo n.º 6
0
    def test_schema(self):
        env = Env(INT_VAR=int, NOT_PRESENT_VAR=(float, 33.3), STR_VAR=str,
                  INT_LIST=[int], DEFAULT_LIST=([int], [2]))

        self.assertTypeAndValue(int, 42, env('INT_VAR'))
        self.assertTypeAndValue(float, 33.3, env('NOT_PRESENT_VAR'))

        self.assertTypeAndValue(str, 'bar', env('STR_VAR'))
        self.assertTypeAndValue(str, 'foo', env('NOT_PRESENT2', default='foo'))

        self.assertTypeAndValue(list, [42, 33], env('INT_LIST'))
        self.assertTypeAndValue(list, [2], env('DEFAULT_LIST'))

        # Override schema in this one case
        self.assertTypeAndValue(str, '42', env('INT_VAR', cast=str))
Exemplo n.º 7
0
def test_decrypt_env_missing_param(monkeypatch):
    monkeypatch.setattr(
        Env,
        "ENVIRON",
        {
            "TEST_VAR": "ok",
            "TEST_DECRYPT": "prefix-{{ SECRET_KEY }}-data"
        },
    )

    store = MockStore({})

    env = Env()

    with pytest.raises(MissingParameterException):
        resolve_django_environ(env, store)
Exemplo n.º 8
0
    def test_schema(self):
        env = Env(
            INT_VAR=int,
            NOT_PRESENT_VAR=(float, 33.3),
            STR_VAR=str,
            INT_LIST=[int],
            DEFAULT_LIST=([int], [2]),
        )

        self.assertTypeAndValue(int, 42, env("INT_VAR"))
        self.assertTypeAndValue(float, 33.3, env("NOT_PRESENT_VAR"))

        self.assertEqual("bar", env("STR_VAR"))
        self.assertEqual("foo", env("NOT_PRESENT2", default="foo"))

        self.assertTypeAndValue(list, [42, 33], env("INT_LIST"))
        self.assertTypeAndValue(list, [2], env("DEFAULT_LIST"))

        # Override schema in this one case
        self.assertTypeAndValue(str, "42", env("INT_VAR", cast=str))
Exemplo n.º 9
0
import json
import os

from django.urls import reverse_lazy
from environ import Env

# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))

ENV_FILE = os.path.join(BASE_DIR, ".env")
if os.path.exists(ENV_FILE):
    Env.read_env(ENV_FILE)

env = Env(
    ALLOWED_HOSTS=(str, ""),
    DEBUG=(bool, False),
)

# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/3.0/howto/deployment/checklist/

# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = env('DJANGO_SECRET_KEY')

# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = env("DEBUG")

ALLOWED_HOSTS = json.loads(
    env("ALLOWED_HOSTS")) if env("ALLOWED_HOSTS") else []

# Application definition
Exemplo n.º 10
0
https://docs.djangoproject.com/en/3.1/topics/settings/

For the full list of settings and their values, see
https://docs.djangoproject.com/en/3.1/ref/settings/
"""

import os
import secrets
import sys
from pathlib import Path

import sentry_sdk
from environ import Env
from sentry_sdk.integrations.django import DjangoIntegration

env = Env(DEBUG=(bool, False), SENTRY_DSN=(str, ""))

sentry_sdk.init(dsn=env('SENTRY_DSN'),
                integrations=[DjangoIntegration()],
                send_default_pii=True)

# Build paths inside the project like this: BASE_DIR / 'subdir'.
BASE_DIR = Path(__file__).resolve().parent.parent

DEBUG = env("DEBUG")

if DEBUG:
    ALLOWED_HOSTS = env.list("ALLOWED_HOSTS",
                             default=["localhost", "0.0.0.0", "web"])
    SECRET_KEY = "is this debug mode"
elif "CI" in os.environ:
Exemplo n.º 11
0
from typing import Tuple

import sentry_sdk
from corsheaders.defaults import default_methods, default_headers
from environ import Env
from sentry_sdk.integrations.celery import CeleryIntegration
from sentry_sdk.integrations.django import DjangoIntegration

from .helpers import (
    DEFAULT_APPS, DEFAULT_MIDDLEWARE, REST_FRAMEWORK_SETTINGS,
    DEFAULT_VALIDATORS, DEFAULT_TEMPLATES
)

BASE_DIR: str = dirname(dirname(abspath(__file__)))
# Environment variables
env: Env = Env()
Env.read_env()
# Sentry
SENTRY_DSN: str = env.str(var='SENTRY_DSN')
sentry_sdk.init(
    dsn=SENTRY_DSN, integrations=(DjangoIntegration(), CeleryIntegration())
)
# Django
DEBUG: bool = env.bool(var='DEBUG')
SECRET_KEY: str = env.str(var='SECRET_KEY')
APPEND_SLASH: bool = True
ALLOWED_HOSTS: Tuple = ('*',)
INSTALLED_APPS: Tuple = DEFAULT_APPS
MIDDLEWARE: Tuple = DEFAULT_MIDDLEWARE
ROOT_URLCONF: str = 'core.urls'
TEMPLATES: Tuple = DEFAULT_TEMPLATES
Exemplo n.º 12
0
from environ import Env
environ = Env()


def test_all(container):
    c = container
    c.run(["""eval "$(./shell.py --dry-run)" """,
           "bootstrap",
           "cd hmlet",
           'eval "$(./shell.py --dry-run)"',
           "./cluster.py bootstrap_local_dev"])
Exemplo n.º 13
0
For more information on this file, see
https://docs.djangoproject.com/en/3.1/topics/settings/

For the full list of settings and their values, see
https://docs.djangoproject.com/en/3.1/ref/settings/
"""
import os
from pathlib import Path
from environ import Env
import socket

env = Env(
    DEBUG=(bool, False),
    # SECRET_KEY = (str, 'none'),
    SENDGRID_API_KEY=(str, 'none'),
    STRIPE_TEST_PUBLISHABLE_KEY=(str, 'key'),
    STRIP_TEST_SECRET_KEY=(str, 'secret'),
)

# Read environ file
Env.read_env()

# Build paths inside the project like this: BASE_DIR / 'subdir'.
BASE_DIR = Path(__file__).resolve().parent.parent

ENVIRONMENT = os.environ.get('ENVIRONMENT', default='development')

# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/3.1/howto/deployment/checklist/
Exemplo n.º 14
0
For more information on this file, see
https://docs.djangoproject.com/en/3.1/topics/settings/

For the full list of settings and their values, see
https://docs.djangoproject.com/en/3.1/ref/settings/
"""
import os
from pathlib import Path
from environ import Env
# Build paths inside the project like this: BASE_DIR / 'subdir'.
BASE_DIR = Path(__file__).resolve().parent.parent

# Create environment variable
env = Env(
    DEBUG = (bool, False),
    SECRET_KEY = (str, 'none')
)
# Read environment variable
Env.read_env()

# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/3.1/howto/deployment/checklist/

# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = env('SECRET_KEY')

# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = ('DEBUG')

ALLOWED_HOSTS = []
Exemplo n.º 15
0
"""Settings for your application."""
from datetime import timedelta
from typing import Any, Dict, List, Tuple, Type
from urllib.parse import urlparse

import sentry_sdk
from environ import Env
from sentry_sdk.integrations.django import DjangoIntegration

env = Env()

# Bootstrap debug
DEBUG = env.bool("DEBUG")

default_databse_url = env.NOTSET

scheme: Dict[str, Tuple[Type, Any]] = {
    "CELERY_BROKER_URL": (str, "redis://"),
    "AXES_META_PRECEDENCE_ORDER":
    (tuple, ("HTTP_X_FORWARDED_FOR", "X_FORWARDED_FOR")),
    "SENTRY_ENABLED": (bool, True),
    "SENTRY_ENVIRONMENT": (str, "production"),
}

if DEBUG:
    default_databse_url = (  # pylint: disable=invalid-name
        "postgres://*****:*****@db:5432/django")
    scheme = {
        **scheme,
        **{
            "CELERY_BROKER_URL": (str, "redis://redis/0"),
Exemplo n.º 16
0
"""
Django settings for application project.
"""
from os.path import abspath, dirname, join
from environ import Env

env = Env()  # pylint: disable=invalid-name
{%- if cookiecutter.monitoring == 'Sentry' %}

SENTRY_DSN = env('SENTRY_DSN', default=None)

if SENTRY_DSN:
    import sentry_sdk

    sentry_sdk.init(dsn=SENTRY_DSN, integrations=[
        sentry_sdk.integrations.django.DjangoIntegration(),
    ])
{%- endif %}

BASE_DIR = dirname(dirname(abspath(__file__)))

DEBUG = env.bool('DJANGO_DEBUG', default=False)

SECRET_KEY = 'dummy-secret' if DEBUG else env('DJANGO_SECRET_KEY')

ALLOWED_HOSTS = ['*']

LOGGING = {
    'version': 1,
    'disable_existing_loggers': False,
    'handlers': {
Exemplo n.º 17
0
 def setUp(self):
     self._old_environ = os.environ
     os.environ = Env.ENVIRON = self.generateData()
     self.env = Env()
Exemplo n.º 18
0
For more information on this file, see
https://docs.djangoproject.com/en/3.1/topics/settings/

For the full list of settings and their values, see
https://docs.djangoproject.com/en/3.1/ref/settings/
"""

from pathlib import Path

from environ import Env
# Build paths inside the project like this: BASE_DIR / 'subdir'.
BASE_DIR = Path(__file__).resolve().parent.parent.parent

env = Env(
    DJ_DEBUG=(bool, False),
    DJ_RABBITMQ_DEBUG=(bool, False),
)
Env.read_env()


# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/3.1/howto/deployment/checklist/

# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = env('DJ_SECRET_KEY')

# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = env('DJ_DEBUG')

ALLOWED_HOSTS = []
Exemplo n.º 19
0
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))

ENV_FILE = os.path.join(BASE_DIR, ".env")
if os.path.exists(ENV_FILE):
    Env.read_env(ENV_FILE)

env = Env(
    ALLOWED_HOSTS=(str, ""),
    DEBUG=(bool, False),
    LOG_LEVEL=(str, "INFO"),
    SECURE_HSTS_ENABLED=(bool, False),
    CSP_DEFAULT_SRC=(tuple, ("'self'", )),
    CSP_STYLE_SRC=(tuple, ("'self'", )),
    CSP_SCRIPT_SRC=(tuple, ("'self'", )),
    CSP_FONT_SRC=(tuple, ("'self'", )),
    CSP_REPORT_ONLY=(bool, False),
    HAWK_AUTHENTICATION_ENABLED=(bool, False),
    LITE_SPIRE_ARCHIVE_CLIENT_BASE_URL=str,
    LITE_SPIRE_ARCHIVE_CLIENT_HAWK_SECRET=str,
    LITE_SPIRE_ARCHIVE_CLIENT_HAWK_SENDER_ID=(str, "lite-internal-frontend"),
    LITE_SPIRE_ARCHIVE_CLIENT_DEFAULT_TIMEOUT=(int, 2000),
    LITE_SPIRE_ARCHIVE_EXAMPLE_ORGANISATION_ID=int,
)

# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/2.1/howto/deployment/checklist/

# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = env("DJANGO_SECRET_KEY")
Exemplo n.º 20
0
 def setUp(self):
     self.env = Env()
     self.environ = self.generateData()
     self._orig_environ = os.environ
     os.environ = self.environ
Exemplo n.º 21
0
import os
from environ import Env

ENV = Env(DEBUG=(bool, False),
          SECRET_KEY=(str, 'change me'),
          DATABASE_URL=(str, 'sqlite:////tmp/db.sqlite3'),
          ALLOWED_HOSTS=(list, ['*']),
          LANGUAGE_CODE=(str, 'en-us'),
          TIMEZONE=(str, 'UTC'))

ENV.read_env()

BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
SECRET_KEY = ENV('SECRET_KEY')
DEBUG = ENV('DEBUG')
ALLOWED_HOSTS = ENV('ALLOWED_HOSTS')
DATABASES = {'default': ENV.db()}
LANGUAGE_CODE = ENV('LANGUAGE_CODE')
TIME_ZONE = ENV('TIMEZONE')

USE_TZ = True

CELERY_APP = 'datama'
CELERY_BROKER_URL = 'amqp://localhost'
CELERY_BIN = 'celery'

INSTALLED_APPS = [
    'django.contrib.admin', 'django.contrib.auth',
    'django.contrib.contenttypes', 'django.contrib.sessions',
    'django.contrib.messages', 'django.contrib.staticfiles', 'manager'
]
Exemplo n.º 22
0
# Allow CORS, can be removed for final build (see also
# INSTALLED_APPS and MIDDLEWARE)
CORS_ORIGIN_ALLOW_ALL = True

# Build paths inside the project like this: BASE_DIR / 'subdir'.
BASE_DIR = Path(__file__).resolve().parent.parent

try:
    envDBURL = os.environ['DATABASE_URL']
except KeyError:
    envDBURL = ''

# django-environ env setup
env = Env(
    # Default values in case they're not found in .env
    DEBUG=(bool, False),
    DATABASE_URL=(str, envDBURL)
)
Env.read_env()

# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/3.1/howto/deployment/checklist/

# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = env('SECRET_KEY')

# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = env('DEBUG')

ALLOWED_HOSTS = []
Exemplo n.º 23
0
import logging.config

from django.utils.log import DEFAULT_LOGGING
from environ import Env
from environ import Path

# Set Environment
env = Env(
    DEBUG=(bool, False),
    DEFAULT_FROM_EMAIL=(str, 'webmaster@localhost'),
    TIME_ZONE=(str, 'US/Mountain'),
    EMAIL_URL=(str, 'smtp://localhost:1025'),
    REDIS_URL=(str, 'redis://localhost:6379/0'),
    LOGLEVEL=(str, 'INFO'),
    ACTIVE=(bool, False),
)

root = Path(__file__) - 2

# Common
BASE_DIR = root()
SECRET_KEY = env("SECRET_KEY")
ROOT_URLCONF = 'urls'
WSGI_APPLICATION = 'wsgi.application'
ADMINS = [
    ('admin', env("DEFAULT_FROM_EMAIL")),
]
USE_L10N = True

# Datetime
USE_TZ = True
Exemplo n.º 24
0
from environ import Env

PROJECT_DIR = os.path.dirname(os.path.abspath(__file__))
BASE_DIR = os.path.dirname(PROJECT_DIR)

# set default values and casting
env = Env(
    ALLOWED_HOSTS=(list, []),
    BASE_URL=(str, 'http://*****:*****@localhost'),
    EMAIL_HOST_USER=(str, ''),
    EMAIL_HOST_PASSWORD=(str, ''),
    EMAIL_HOST=(str, 'localhost'),
    EMAIL_PORT=(int, 25),
    EMAIL_USE_TLS=(bool, False),
    EMBEDLY_KEY=(str, None),
    MEDIA_ROOT=(str, os.path.join(BASE_DIR, 'media')),
    DBBACKUP_AWS_ACCESS_KEY=(str, None),
    DBBACKUP_AWS_SECRET_KEY=(str, None),
    DBBACKUP_S3_BUCKET_NAME=(str, None),
)
# read from a local, unversioned dev environment file if it exists
local_env_file = os.path.join(PROJECT_DIR, '.env.local')
Env.read_env(
    env_file=local_env_file if os.path.isfile(local_env_file) else None)

DEBUG = env('DEBUG')
Exemplo n.º 25
0
Django settings for config project.

Generated by 'django-admin startproject' using Django 2.1.15.

For more information on this file, see
https://docs.djangoproject.com/en/2.1/topics/settings/

For the full list of settings and their values, see
https://docs.djangoproject.com/en/2.1/ref/settings/
"""

import os

from environ import Env, Path

ENV = Env()

BASE_DIR = Path(__file__) - 3

SECRET_KEY = ENV.str("SECRET_KEY")

DEBUG = ENV.bool("DEBUG", default=False)

ALLOWED_HOSTS = []

# Application definition

INSTALLED_APPS = [
    "corsheaders",
    "whitenoise.runserver_nostatic",
    "django.contrib.admin",
Exemplo n.º 26
0
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)

BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))

ENV_FILE = os.path.join(BASE_DIR, ".env")
if os.path.exists(ENV_FILE):
    Env.read_env(ENV_FILE)

env = Env(
    ALLOWED_HOSTS=(str, ""),
    DEBUG=(bool, False),
    LOG_LEVEL=(str, "INFO"),
    SECURE_HSTS_ENABLED=(bool, False),
    CSP_DEFAULT_SRC=(list, []),
    CSP_STYLE_SRC=(list, []),
    CSP_SCRIPT_SRC=(list, []),
    CSP_FONT_SRC=(list, []),
    CSP_IMG_SRC=(list, []),
    CSP_FRAME_SRC=(list, []),
    CSP_CONNECT_SRC=(list, []),
    CSP_INCLUDE_NONCE_IN=(list, []),
    CSP_REPORT_ONLY=(bool, True),
    HAWK_AUTHENTICATION_ENABLED=(bool, False),
)

DEBUG_PROPAGATE_EXCEPTIONS = True

# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/2.1/howto/deployment/checklist/

# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = env("DJANGO_SECRET_KEY")
Exemplo n.º 27
0
For more information on this file, see
https://docs.djangoproject.com/en/1.10/topics/settings/

For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.10/ref/settings/
"""

import os

from environ import Env

env_file = os.path.join(os.path.dirname(os.path.abspath(__file__)),
                        'settings.env')
Env.read_env(env_file)
env = Env(DEBUG=(bool, False), )

# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))

# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/1.10/howto/deployment/checklist/

# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = env('SECRET_KEY')

# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True

ALLOWED_HOSTS = ['*']
Exemplo n.º 28
0
"""
Django settings for kotopes project.

Generated by 'django-admin startproject' using Django 3.0.11.

For more information on this file, see
https://docs.djangoproject.com/en/3.0/topics/settings/

For the full list of settings and their values, see
https://docs.djangoproject.com/en/3.0/ref/settings/
"""

import os
from environ import Env

env = Env()  # set default values and casting
Env.read_env()  # reading .env file

BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
SECRET_KEY = env('SECRET_KEY')
DEBUG = env('DEBUG', cast=bool, default=False)
ALLOWED_HOSTS = ['*']

# Application definition

INSTALLED_APPS = [
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
Exemplo n.º 29
0
from .helpers.default_apps import DEFAULT_APPS
from .helpers.i18n_settings import (
    DEFAULT_LOCALE_PATHS, DEFAULT_LANGUAGES
)
from .helpers.middlewares import DEFAULT_MIDDLEWARES
from .helpers.rest_framework_settings import (
    REST_FRAMEWORK_SETTINGS
)
from .helpers.storages import STORAGES, DEFAULT_STORAGE
from .helpers.templates import DEFAULT_TEMPLATES
from .helpers.validators import DEFAULT_VALIDATORS

BASE_DIR: str = dirname(dirname(abspath(__file__)))
# Environment variables
env = Env()
Env.read_env()
# Sentry
SENTRY_DSN: str = env.str(var='SENTRY_DSN')
# Django
DEBUG: bool = env.bool(var='DEBUG')
SECRET_KEY: str = env.str(var='SECRET_KEY')
APPEND_SLASH: bool = True
ALLOWED_HOSTS: Tuple = ('*',)
INSTALLED_APPS: Tuple = DEFAULT_APPS
MIDDLEWARE: Tuple = DEFAULT_MIDDLEWARES
ROOT_URLCONF: str = 'core.urls'
TEMPLATES: Tuple = DEFAULT_TEMPLATES
WSGI_APPLICATION: str = 'core.wsgi.application'
DATABASES: MappingProxyType = MappingProxyType({'default': env.db()})
AUTH_PASSWORD_VALIDATORS: Tuple = DEFAULT_VALIDATORS
Exemplo n.º 30
0
import json
import os
import sys

from environ import Env

# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))

ENV_FILE = os.path.join(BASE_DIR, '.env')
if os.path.exists(ENV_FILE):
    Env.read_env(ENV_FILE)

env = Env(
    ALLOWED_HOSTS=(str, ''),
    DEBUG=(bool, False),
    DEBUG_LEVEL=(str, 'INFO'),
)

# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/2.1/howto/deployment/checklist/

# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = '=(kaa@ypr5v!x(s=9^f8)o!k#84f_1v@iz31+cq_)8--@kws4b'

# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = env('DEBUG')

ALLOWED_HOSTS = json.loads(
    env('ALLOWED_HOSTS')) if env('ALLOWED_HOSTS') else []