Exemplo n.º 1
0
class FileEnvTests(EnvTests):

    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
class FileEnvTests(EnvTests):

    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.º 3
0
import os

from environ import Env


BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
assert os.path.isfile(os.path.join(BASE_DIR, 'manage.py'))

env = Env()
env.read_env(os.path.join(BASE_DIR, '.env'))

DEBUG = env.bool('DEBUG', default=False)
SECRET_KEY = env.str('SECRET_KEY', default=('' if not DEBUG else 'xxx'))

DATABASES = {
    'default': env.db_url(
        default='psql://*****:*****@postgres/tallessa',
    ),
}

CACHES = {'default': env.cache_url(default='locmemcache://')}

INSTALLED_APPS = [
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',

    'rest_framework',
Exemplo n.º 4
0
Generated by 'django-admin startproject' using Django 3.1.3.

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
import os
from environ import Env

env = Env()
Env.read_env()

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

# 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 = ')4mdgh!+n%!h%n^33)&72ae)j$5mf76@05!oiq9o0efnp^w_6h'

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

ALLOWED_HOSTS = []
Exemplo n.º 5
0
from os import path

from environ import Path, Env

# Django-environ basics
root = Path(__file__) - 2
env = Env(DEBUG=(bool, False),)

# Read a file with environment variables, these variables can be used to set the value of django settings
ENV_FILE = str(env.path('ENV_FILE', default='.env'))
if path.isfile(ENV_FILE):
    Env.read_env(ENV_FILE)
else:
    # unset if no file was found
    ENV_FILE = None

# Build paths inside the project like this: path.join(BASE_DIR, ...)
BASE_DIR = root()

# Django Debug option
DEBUG = env.bool('DEBUG')

# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = env('SECRET_KEY', default='xt515nl958u+8sbk_e($p%g_$olz9)!y)8+snv*yhsk1!hm(_c')

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

ALLOWED_HOSTS = env.list('ALLOWED_HOSTS', default=[])

# Application definition
Exemplo n.º 6
0
    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')

SECRET_KEY = env('SECRET_KEY')

ALLOWED_HOSTS = env('ALLOWED_HOSTS')

# make Django log to stderr
LOGGING = {
    'version': 1,
    'disable_existing_loggers': False,
    'handlers': {
        'console': {
            'class': 'logging.StreamHandler',
Exemplo n.º 7
0
Generated by 'django-admin startproject' using Django 1.10.5.

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
Exemplo n.º 8
0
import os
from datetime import timedelta

from environ import Env
from raven import fetch_git_sha
from raven.exceptions import InvalidGitRepository

BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
assert os.path.isfile(os.path.join(BASE_DIR, 'manage.py'))

#####################
# Local environment #
#####################
env = Env()
env.read_env(os.path.join(BASE_DIR, '.env'))

########################
# Django core settings #
########################
DEBUG = env.bool('DEBUG', default=False)
TIER = env.str('TIER', default='dev')
SECRET_KEY = env.str('SECRET_KEY', default=('' if not DEBUG else 'xxx'))
ALLOWED_HOSTS = ['*']

#########
# Paths #
#########
default_var_root = os.path.join(BASE_DIR, 'var')
user_var_root = os.path.expanduser('~/var')
if os.path.isdir(user_var_root):
    default_var_root = user_var_root
Exemplo n.º 9
0
"""
Django settings for application project.
"""
from os.path import abspath, dirname, join
from environ import Env
BASE_DIR = dirname(dirname(abspath(__file__)))

env = Env()  # pylint: disable=invalid-name
Env.read_env(join(BASE_DIR, '.env'))

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

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

ALLOWED_HOSTS = [] if DEBUG else [
    'example.com',
]

# Application definition

INSTALLED_APPS = [
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    {%- if cookiecutter.monitoring == 'Datadog' %}
    'django_datadog',
    {%- elif cookiecutter.monitoring == 'Sentry' %}
    'raven.contrib.django.raven_compat',
Exemplo n.º 10
0
"""
Base settings to build other settings files upon.
"""
from pathlib import Path

from environ import Env

ROOT_DIR = Path(__file__).resolve(strict=True).parent.parent.parent
# chuckzbot/
APPS_DIR = ROOT_DIR / "chuckzbot"
env = Env()

READ_DOT_ENV_FILE = env.bool("DJANGO_READ_DOT_ENV_FILE", default=True)
if READ_DOT_ENV_FILE:
    # OS environment variables take precedence over variables from .env
    env.read_env(str(ROOT_DIR / ".env"))

# GENERAL
# ------------------------------------------------------------------------------
# https://docs.djangoproject.com/en/dev/ref/settings/#debug
DEBUG = env.bool("DJANGO_DEBUG", False)
# Local time zone. Choices are
# http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
# though not all of them may be available with every OS.
# In Windows, this must be set to your system time zone.
TIME_ZONE = "UTC"
# https://docs.djangoproject.com/en/dev/ref/settings/#language-code
LANGUAGE_CODE = "en-us"
# https://docs.djangoproject.com/en/dev/ref/settings/#site-id
SITE_ID = 1
# https://docs.djangoproject.com/en/dev/ref/settings/#use-i18n
Exemplo n.º 11
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
import os

from django.utils.translation import gettext_lazy as _

env = Env()

env.read_env(env_file="proj/.env")

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

# 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 = int(env("DEBUG", default=0))

ALLOWED_HOSTS = env("DJANGO_ALLOWED_HOSTS").split(" ")
Exemplo n.º 12
0
from pathlib import Path
from environ import Env

env = Env()

env.read_env(env_file='config/django/.env')

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

# 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('DJANGO_SECRET_KEY')

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

ALLOWED_HOSTS = []

# Application definition

INSTALLED_APPS = [
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    'blog.apps.BlogConfig',
Exemplo n.º 13
0
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()
env_file = Path.joinpath(BASE_DIR, ".env")
if Path(env_file).is_file():
    env.read_env(env_file.as_posix())


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



# Custom User Model

AUTH_USER_MODEL = 'accounts.User'

# Application definition

INSTALLED_APPS = [
    'django.contrib.admin',
Exemplo n.º 14
0
from environ import Env

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

# Environment object with **default** types and values for specific variables
#   It is also possible to setup a default value when calling the Env object
#       env('ENV_VAR', default='value', parse_default=True, cast=int)
env = Env(DEBUG=(bool, False),
          SECRET_KEY=(str, 'CHANGE_ME_PLEASE'),
          DATABASE_URL=(str,
                        'sqlite:///' + join(BASE_DIR, 'database/db.sqlite3')))

if env('DEBUG'):
    Env.read_env()  # Reads .env file

# SECURITY WARNING: keep the secret key used in production secret!
# Raises django's ImproperlyConfigured exception if SECRET_KEY not in os.environ
SECRET_KEY = env('SECRET_KEY')

DEBUG = env('DEBUG')

ALLOWED_HOSTS = ['*']

# Application definition

INSTALLED_APPS = [
    # My apps
    'notes',
    # CORS HTTP Special headers
Exemplo n.º 15
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/
"""

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

env = Env(DJANGO_SECRET=(str,
                         '7(vh94ytfxtxa$$9edz$7fdiv8+ej2_u+d5azrfslo59cwg^$h'))

Env.read_env(env_file=str(BASE_DIR.parent / '.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('DJANGO_SECRET')

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

ALLOWED_HOSTS = env.list('ALLOWED_HOSTS', default=['*'])

# Application definition

INSTALLED_APPS = [
Exemplo n.º 16
0
from environ import Env, Path

root = Path(__file__) - 2 # two folders up
BASE_DIR = root()

# set default values and casting
env = Env(
    DEBUG=(bool, False),
)
Env.read_env()

DEBUG = env('DEBUG')

SECRET_KEY = env('SECRET_KEY')

ALLOWED_HOSTS = [
    '.nova.jobs'
]

INSTALLED_APPS = (
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    'compressor',
    #'core',
    #'signup',
    #'scheduler',
    #'review',
    'homepage',
Exemplo n.º 17
0
PROJECT_PATH = REPO_PATH = dirname(PACKAGE_PATH)

RESOURCE_DIR = 'resources'
RESOURCES_PATH = join(REPO_PATH, RESOURCE_DIR)

LOG_PATH = join(RESOURCES_PATH, 'logs')

FIXTURES_DIR = 'fixtures'
FIXTURES_PATH = join(REPO_PATH, FIXTURES_DIR)

# Add our project to our pythonpath, this way we don't need to type our project
# name in our dotted import paths:
path.append(PROJECT_PATH)

# load environment variables
Env.read_env(normpath(join(REPO_PATH, '.env')))
env = Env()
######### END PATH CONFIGURATION

########## OPEN_RICOSTRUZIONE CONFIGURATION
DEBUG = env.bool('DEBUG', False)
TEMPLATE_DEBUG = env.bool('TEMPLATE_DEBUG', False)
INSTANCE_TYPE = env.str('INSTANCE_TYPE', '')

ADMINS = (('Guglielmo Celata', '*****@*****.**'), )

MANAGERS = ADMINS

DATABASES = {
    'default':
    env.db('DB_DEFAULT_URL',
Exemplo n.º 18
0
REPO_PATH = dirname(PROJECT_PATH)
REPO_NAME = "mosic2-area-riservata" or basename(REPO_PATH)

CONFIG_DIR = 'config'
CONFIG_PATH = join(REPO_PATH, CONFIG_DIR)

RESOURCE_DIR = 'resources'
RESOURCES_PATH = join(REPO_PATH, RESOURCE_DIR)

# Add our project to our pythonpath, this way we don't need to type our project
# name in our dotted import paths:
path.append(PROJECT_PATH)

# load environment variables
Env.read_env(normpath(join(CONFIG_PATH, '.env')))
env = Env()
########## END PATH CONFIGURATION

########## DEBUG CONFIGURATION
# See: https://docs.djangoproject.com/en/dev/ref/settings/#debug
DEBUG = env.bool('DEBUG', False)
DEBUG_TOOLBAR = env.bool('DEBUG_TOOLBAR', DEBUG)
########## END DEBUG CONFIGURATION

########## MANAGER CONFIGURATION
ADMIN_EMAIL = env('ADMIN_EMAIL', default='admin@%s.com' % PROJECT_NAME)
ADMIN_NAME = env('ADMIN_NAME', default=ADMIN_EMAIL.split('@')[0])

# See: https://docs.djangoproject.com/en/dev/ref/settings/#admins
ADMINS = ((ADMIN_EMAIL, ADMIN_NAME), )
Exemplo n.º 19
0
https://docs.djangoproject.com/en/3.1/ref/settings/
"""

from pathlib import Path

# noinspection PyPackageRequirements
import sentry_sdk
from environ import Env
from sentry_sdk.integrations.django import DjangoIntegration

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

# Read from dotenv file
env = Env()
env.read_env(str(BASE_DIR / ".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", bool, False)

ALLOWED_HOSTS = env("ALLOWED_HOSTS", list, [])

# Application definition

INSTALLED_APPS = [
Exemplo n.º 20
0
import sys
from environ import Env, Path
from .aws.conf import *

# Provide default values here
env = Env(DEBUG=(bool, False))
root = Path(__file__) - 2

BASE_DIR = root()

# Tell Django to look for apps in "apps" folder
sys.path.append(os.path.join(BASE_DIR, 'apps'))

# Get settings from environment variables

env.read_env('.env')

SECRET_KEY = env('SECRET_KEY')

DEBUG = env('DEBUG')

ALLOWED_HOSTS = []

STRIPE_SECRET_KEY = env('STRIPE_SECRET_KEY')

# Application definition

INSTALLED_APPS = [
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
Exemplo n.º 21
0
Generated by 'django-admin startproject' using Django 3.1.1.

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

env = Env()
env.read_env(env_file='portfolio/.env')


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


# 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!
Exemplo n.º 22
0
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

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

# Environment vartiables
ENV_PATH = os.path.join(BASE_DIR, '.env')

env = Env()
if os.path.exists(ENV_PATH):
    env.read_env(ENV_PATH)

# 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 = 'yf*_w^xhy=(wn16llvhm2#&^4f@-&-4n&@0)hk(oeks4(#f^(+'

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

ALLOWED_HOSTS = []

# Application definition

INSTALLED_APPS = [
Exemplo n.º 23
0
Generated by 'django-admin startproject' using Django 3.2.

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

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

from environ import Env

env = Env()

env.read_env(env_file="admin/.env")

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


# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/3.2/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("DJANGO_DEBUG", default=False)

ALLOWED_HOSTS = [env("DJANGO_ALLOWED_HOSTS")]
Exemplo n.º 24
0
from ipaddress import ip_address
from pathlib import Path
from typing import Optional

from environ import Env, ImproperlyConfigured


env = Env()
Env.read_env('config.env')


def cast_path(value):
    if not value:
        return None
    return Path(value)


def cast_int_or_none(value):
    try:
        return int(value)
    except (ValueError, TypeError):
        return None


class Config:

    # Folder where reports
    folder: Path = env('FOLDER', cast=cast_path, default=None)
    # Output folder for positive and negative
    output_folder: Path = env('OUTPUT_FOLDER', cast=cast_path, default=None)
Exemplo n.º 25
0
Django settings for config project.

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

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

env = Env()
env.read_env(env_file='config/.env')

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


# 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('DJANGO_SECRET_KEY')

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

ALLOWED_HOSTS = []
Exemplo n.º 26
0
For the full list of settings and their values, see
https://docs.djangoproject.com/en/3.0/ref/settings/
"""

import os
from types import MappingProxyType

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 = Env()
env.read_env()

# 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 = '(=pgbd!qyg3+_!1^y0*n4&qbx!gg=(dvve@yh_8*#a)_8n)=v!'

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

ALLOWED_HOSTS = ('*', )

# Application definition

INSTALLED_APPS = [
Exemplo n.º 27
0
PROJECT_PATH = REPO_PATH = dirname(PACKAGE_PATH)

RESOURCE_DIR = 'resources'
RESOURCES_PATH = join(REPO_PATH, RESOURCE_DIR)

LOG_PATH = join(RESOURCES_PATH,'logs')

FIXTURES_DIR = 'fixtures'
FIXTURES_PATH = join(REPO_PATH, FIXTURES_DIR)

# Add our project to our pythonpath, this way we don't need to type our project
# name in our dotted import paths:
path.append(PROJECT_PATH)

# load environment variables
Env.read_env(normpath(join(REPO_PATH, '.env')))
env = Env()
######### END PATH CONFIGURATION

########## OPEN_RICOSTRUZIONE CONFIGURATION
DEBUG = env.bool('DEBUG', False)
TEMPLATE_DEBUG = env.bool('TEMPLATE_DEBUG', False)
INSTANCE_TYPE = env.str('INSTANCE_TYPE', '')

ADMINS = (
    ('Guglielmo Celata', '*****@*****.**'),
)

MANAGERS = ADMINS

DATABASES = {
Exemplo n.º 28
0
import os

from environ import Env

env = Env()
HOME_DIR = env.str(
    "HOME_DIR",
    default=os.path.realpath(os.path.join(os.path.dirname(__file__), ".."))
)

env.read_env(os.path.join(HOME_DIR, ".env"))
DEBUG = env.bool("DEBUG", False)
SECRET_KEY = env.bool("SECRET_KEY", "Sehr lecker Wurst" if DEBUG else Env.NOTSET)
ALLOWED_HOSTS = env.list("ALLOWED_HOSTS", default=["*"])
DATABASES = {
    "default": env.db_url(default="sqlite:///%s" % os.path.join(HOME_DIR, "wurst.sqlite3"))
}
STATIC_ROOT = env.str("STATIC_ROOT", default=os.path.join(HOME_DIR, "static"))
MEDIA_ROOT = env.str("MEDIA_ROOT", default=os.path.join(HOME_DIR, "media"))

INSTALLED_APPS = [
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    'reversion',
    'rest_framework',
    'rest_framework.authtoken',
    'wurst.core',
Exemplo n.º 29
0
# Django settings for project project.
import os
from environ import Env, Path
import pathlib
from django.core.exceptions import ImproperlyConfigured

DEBUG = False


PROJECT_ROOT = pathlib.Path(__file__).parent.parent.parent
PROJECT_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
BASE_DIR = os.path.dirname(PROJECT_DIR)
STATIC_ROOT = os.path.join(BASE_DIR, 'static')

env = Env(DEBUG=(bool, False),)
Env.read_env('.env')
DEBUG = env('DEBUG')

ADMINS = (
    ('Greg Azevedo', '*****@*****.**'),
)

MANAGERS = ADMINS


# Local time zone for this installation. Choices can be found here:
# http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
# although not all choices may be available on all operating systems.
# In a Windows environment this must be set to your system time zone.
TIME_ZONE = 'UTC'
Exemplo n.º 30
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.º 31
0
REPO_PATH = dirname(PROJECT_PATH)
REPO_NAME = "op-accesso" or basename(REPO_PATH)

CONFIG_DIR = 'config'
CONFIG_PATH = join(REPO_PATH, CONFIG_DIR)

RESOURCE_DIR = 'resources'
RESOURCES_PATH = join(REPO_PATH, RESOURCE_DIR)

# Add our project to our pythonpath, this way we don't need to type our project
# name in our dotted import paths:
path.append(PROJECT_PATH)

# load environment variables
Env.read_env(normpath(join(CONFIG_PATH, '.env')))
env = Env()
########## END PATH CONFIGURATION


########## DEBUG CONFIGURATION
# See: https://docs.djangoproject.com/en/dev/ref/settings/#debug
DEBUG = env.bool('DEBUG', False)

# See: https://docs.djangoproject.com/en/dev/ref/settings/#template-debug
TEMPLATE_DEBUG = DEBUG
########## END DEBUG CONFIGURATION


########## MANAGER CONFIGURATION
ADMIN_EMAIL = env.str('ADMIN_EMAIL', 'admin@%s.com' % PROJECT_NAME)
Exemplo n.º 32
0
Generated by 'django-admin startproject' using Django 1.10.5.

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 = ['*']