コード例 #1
0
import os

import environ

checkout_dir = environ.Path(__file__) - 2
assert os.path.exists(checkout_dir('manage.py'))

parent_dir = checkout_dir.path('..')
if parent_dir() != '/' and os.path.isdir(parent_dir('etc')):
    env_file = parent_dir('etc/env')
    default_var_root = parent_dir('var')
else:
    env_file = checkout_dir('.env')
    default_var_root = checkout_dir('var')

env = environ.Env(
    DEBUG=(bool, False),
    TIER=(str, 'dev'),  # one of: prod, qa, stage, test, dev
    SECRET_KEY=(str, 'foo'),
    VAR_ROOT=(str, default_var_root),
    ALLOWED_HOSTS=(list, []),
    DATABASE_URL=(str, 'sqlite:///var/db.sqlite3'),
    CACHE_URL=(str, 'locmemcache://'),
    EMAIL_URL=(str, 'consolemail://'),
    SENTRY_DSN=(str, ''),
)
if os.path.exists(env_file):
    env.read_env(env_file)

DEBUG = env.bool('DEBUG')
TIER = env.str('TIER')
コード例 #2
0
ファイル: settings.py プロジェクト: beatum/rubedite
"""
Django settings for rubedite project.

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

For the full list of settings and their values, see
https://docs.djangoproject.com/en/dev/ref/settings/
"""
from datetime import timedelta

import environ

ROOT_DIR = environ.Path(__file__) - 2

# Load operating system environment variables and then prepare to use them
env = environ.Env()

# APP CONFIGURATION
# ------------------------------------------------------------------------------
DJANGO_APPS = [
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    'django.contrib.admin',
]

THIRD_PARTY_APPS = [
    'rest_framework',
コード例 #3
0
"""
Base settings for ether-ready-py project.

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

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

ROOT_DIR = environ.Path(
    __file__
) - 3  # (ether_ready_py/config/settings/base.py - 3 = ether_ready_py/)
APPS_DIR = ROOT_DIR.path('ether_ready_py')

# Load operating system environment variables and then prepare to use them
env = environ.Env()

# .env file, should load only in development environment
READ_DOT_ENV_FILE = env.bool('DJANGO_READ_DOT_ENV_FILE', default=False)

if READ_DOT_ENV_FILE:
    # Operating System Environment variables have precedence over variables defined in the .env file,
    # that is to say variables from the .env files will only be used if not defined
    # as environment variables.
    env_file = str(ROOT_DIR.path('.env'))
    print('Loading : {}'.format(env_file))
    env.read_env(env_file)
    print('The .env file has been loaded. See base.py for more information')
コード例 #4
0
# -*- coding: utf-8 -*-
"""
Django settings for Openbadge Server project.

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

For the full list of settings and their values, see
https://docs.djangoproject.com/en/dev/ref/settings/
"""
from __future__ import absolute_import, unicode_literals

import environ

IMPORT_EXPORT_USE_TRANSACTIONS = True
ROOT_DIR = environ.Path(__file__) - 3  # (openbadge-server/config/settings/common.py - 3 = openbadge-server/)
APPS_DIR = ROOT_DIR.path('openbadge-server')

env = environ.Env()
environ.Env.read_env(ROOT_DIR(".env"))

# APP CONFIGURATION
# ------------------------------------------------------------------------------
THIRD_PARTY_APPS = (
    'pipeline',
    'grappelli',
    'rest_framework',
    'rest_framework.authtoken',
    'rest_framework_expiring_authtoken',
    'controlcenter',
    'import_export',
コード例 #5
0
WSGI config for open_ricostruzione project.

This module contains the WSGI application used by Django's development server
and any production WSGI deployments. It should expose a module-level variable
named ``application``. Django's ``runserver`` and ``runfcgi`` commands discover
this application via the ``WSGI_APPLICATION`` setting.

Usually you will have the standard Django WSGI application here, but it also
might make sense to replace the whole Django WSGI application with a custom one
that later delegates to the Django one. For example, you could introduce WSGI
middleware here, or combine a Django application with an application of another
framework.

"""
import os
import environ
root = environ.Path(__file__) - 2  # (/open_ricostruzione/ - 1 = /)
env = environ.Env(DEBUG=(bool, True), )
env.read_env(root('.env'))
os.environ.setdefault("DJANGO_SETTINGS_MODULE", env('DJANGO_SETTINGS_MODULE'))

# This application object is used by any WSGI server configured to use this
# file. This includes Django's development server, if the WSGI_APPLICATION
# setting points here.
from django.core.wsgi import get_wsgi_application
application = get_wsgi_application()

# Apply WSGI middleware here.
# from helloworld.wsgi import HelloWorldApplication
# application = HelloWorldApplication(application)
コード例 #6
0
ファイル: defaults.py プロジェクト: ivancurak/donate-wagtail
import environ

app = environ.Path(__file__) - 2

CSP_DEFAULT_SRC = ("'self'")
CSP_SCRIPT_SRC = ("'self'", "'unsafe-inline'", 'www.google-analytics.com',
                  'js.braintreegateway.com', 'assets.braintreegateway.com',
                  'www.paypalobjects.com', 'c.paypal.com', 'www.paypal.com')
CSP_IMG_SRC = ('*', "data:")
CSP_FONT_SRC = ("'self'", 'fonts.googleapis.com', 'fonts.gstatic.com')
CSP_STYLE_SRC = ("'self'", "'unsafe-inline'", 'https://fonts.googleapis.com',
                 'https://fonts.gstatic.com')
CSP_FRAME_SRC = ("'self'", 'assets.braintreegateway.com', 'c.paypal.com',
                 '*.paypal.com')
CSP_CONNECT_SRC = ("'self'", 'api.sandbox.braintreegateway.com',
                   'client-analytics.sandbox.braintreegateway.com',
                   'api.braintreegateway.com',
                   'client-analytics.braintreegateway.com',
                   '*.braintree-api.com', 'www.paypal.com',
                   'www.google-analytics.com',
                   'https://www.mozilla.org/en-US/newsletter/',
                   'https://sentry.prod.mozaws.net')
CSP_BASE_URI = CSP_DEFAULT_SRC
CSP_WORKER_SRC = CSP_DEFAULT_SRC

BRAINTREE_MERCHANT_ACCOUNTS = {
    'usd': 'mozillafoundation',
    'aud': 'MozillaFoundat_AUD',
    'brl': 'MozillaFoundat_BRL',
    'cad': 'MozillaFoundat_CAD',
    'chf': 'MozillaFoundat_CHF',
コード例 #7
0
ファイル: common.py プロジェクト: rovercode/rovercode-web
"""
Django settings for Rovercode Web project.

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

For the full list of settings and their values, see
https://docs.djangoproject.com/en/dev/ref/settings/
"""
from __future__ import absolute_import, unicode_literals
import datetime

import environ
from urllib.parse import urlparse

ROOT_DIR = environ.Path(__file__) - 3  # (rovercode_web/config/settings/common.py - 3 = rovercode_web/)
APPS_DIR = ROOT_DIR

env = environ.Env()
env.read_env()

# APP CONFIGURATION
# ------------------------------------------------------------------------------
DJANGO_APPS = (
    # Default Django apps:
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.sites',
    'django.contrib.messages',
    'django.contrib.staticfiles',
コード例 #8
0
ファイル: settings.py プロジェクト: cafelow/eahub.org
import environ
from django.core import exceptions
from django.utils.safestring import mark_safe

env = environ.Env()
base_dir = environ.Path(__file__) - 3

# Core settings: cache
CACHES = {
    "default": env.cache_url("CACHE_URL",
                             backend="django_redis.cache.RedisCache")
}

# Core settings: database
DATABASES = {
    "default": env.db_url("DATABASE_URL",
                          engine="django.db.backends.postgresql")
}
if "LEGACY_DATABASE_URL" in env:
    DATABASES["legacy"] = env.db_url("LEGACY_DATABASE_URL",
                                     engine="django.db.backends.mysql")

# Core settings: debugging
DEBUG = env.bool("DEBUG")

# Core settings: email
vars().update(
    env.email_url("EMAIL_URL",
                  backend="django.core.mail.backends.smtp.EmailBackend"))
ADMINS = list(env.dict("ADMINS").items())
DEFAULT_FROM_EMAIL = "EA Hub <*****@*****.**>"
コード例 #9
0
Generated by 'django-admin startproject' using Django 2.1.3.

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

import environ

# ENVIRONMENT CONFIGURATION
# --------------------------------------------------------------------------------------------------
ROOT_DIR = environ.Path(__file__) - 2  # (gv/config/settings/base.py - 3 = gv/)

# Load operating system environment variables and then prepare to use them
env = environ.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__)))

# 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 = 'd6f*n#bd@j%!2ckcay!n^ucyn49&te9+m#jrx3175#c8=2dmu$'

# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = False
コード例 #10
0
# -*- coding: utf-8 -*-
"""
Django settings for music_recommender project.

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

For the full list of settings and their values, see
https://docs.djangoproject.com/en/dev/ref/settings/
"""
from __future__ import absolute_import, unicode_literals

import environ

ROOT_DIR = environ.Path(
    __file__
) - 3  # (music_recommender/config/settings/common.py - 3 = music_recommender/)
APPS_DIR = ROOT_DIR.path('music_recommender')

env = environ.Env()
env.read_env()

# APP CONFIGURATION
# ------------------------------------------------------------------------------
DJANGO_APPS = (
    # Default Django apps:
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.sites',
    'django.contrib.messages',
コード例 #11
0
import environ
import os

ROOT_DIR = environ.Path(__file__) - 2  # (/a/b/myfile.py - 2 = /a)

# Local environment
# -----------------
env = environ.Env()

if os.path.isfile(".env"):
    env.read_env(".env")

# APP CONFIGURATION
# ------------------------------------------------------------------------------
DJANGO_APPS = (
    "django.contrib.auth",
    "django.contrib.contenttypes",
    "django.contrib.sessions",
    "django.contrib.messages",
    "django.contrib.staticfiles",
    "django.contrib.admin",
)
THIRD_PARTY_APPS = (
    "corsheaders",
    "django_extensions",
    "django_rq",
    "graphene_django",
    "silk",
)
LOCAL_APPS = ("thefederation", )
コード例 #12
0
# coding=utf-8
"""
Django settings for django polls project.

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

For the full list of settings and their values, see
https://docs.djangoproject.com/en/dev/ref/settings/
"""
from __future__ import absolute_import, unicode_literals

import environ

ROOT_DIR = environ.Path(__file__) - 3  # (django_polls/config/settings/common.py - 3 = django_polls/)
APPS_DIR = ROOT_DIR.path('django_polls')

env = environ.Env()

# APP CONFIGURATION
# ------------------------------------------------------------------------------
DJANGO_APPS = (
    # Default Django apps:
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.sites',
    'django.contrib.messages',
    'django.contrib.staticfiles',

    # Useful template tags:
コード例 #13
0
ファイル: settings.py プロジェクト: alanoe/opencraft
To configure your instance, set the configuration variables,
using the variable name passed to `env()` below
"""

# Imports #####################################################################

import logging
import os
from urllib.parse import urlparse

import environ

# Functions ###################################################################

env = environ.Env()
root = environ.Path(os.path.dirname(__file__), os.pardir)

SITE_ROOT = root()

# Security ####################################################################

# Keep the secret key used in production secret
SECRET_KEY = env('SECRET_KEY')

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

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

ENABLE_DEBUG_TOOLBAR = env.bool('ENABLE_DEBUG_TOOLBAR', default=False)

SITE_ID = 1
コード例 #14
0
ファイル: base.py プロジェクト: nicorellius/fiblist
Django settings for fiblist project.

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

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

# Build paths inside the project like this: os.path.join(*_DIR, ...)
import os
import environ # https://github.com/joke2k/django-environ

# /home/nick/dev/django/projects/fiblist
# PROJECT_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__name__)))
PROJECT_DIR = environ.Path(__file__) - 5

# /home/nick/dev/django/projects/fiblist/source
# SOURCE_DIR = os.path.abspath(os.path.dirname(os.path.dirname(__name__)))
SOURCE_DIR = environ.Path(__file__) - 4

# /home/nick/dev/django/projects/fiblist/source/fiblist/conf
# CONF_DIR = os.path.dirname(os.path.dirname(__file__))
ONCF_DIR = environ.Path(__file__) - 2

# /home/nick/dev/django/projects/fiblist/source/fiblist/conf/settings
# SETTINGS_DIR = os.path.dirname(__file__)
SETTINGS_DIR = environ.Path(__file__) - 1

# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
コード例 #15
0
ファイル: base.py プロジェクト: th3f1v3/scantron
For more information on this file, see
https://docs.djangoproject.com/en/dev/topics/settings/

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

# JSON-based secrets module.
# ------------------------------------------------------------------------------
import json
import os

from django.core.exceptions import ImproperlyConfigured

ROOT_DIR = environ.Path(
    __file__) - 3  # (master/config/settings/base.py - 3 = scantron/)
APPS_DIR = ROOT_DIR.path("django_scantron")  # scantron/master/django_scantron

# scantron_secrets.json sits in the root of the scantron folder.
with open(os.path.join(str(ROOT_DIR), "scantron_secrets.json")) as fh:
    secrets_environment = os.environ["DJANGO_SETTINGS_MODULE"].split(".")[-1]
    print(f"[*] Loading [ {secrets_environment} ] scantron_secrets.json")
    SECRETS = json.loads(fh.read())


def get_secret(setting, secrets=SECRETS):
    """
    Get the secret variable or return explicit exception.
    """
    try:
        if os.environ["DJANGO_SETTINGS_MODULE"] == "config.settings.local":
コード例 #16
0
ファイル: base.py プロジェクト: hyecheon/python_api
"""
Base settings for python-api project.

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

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

ROOT_DIR = environ.Path(__file__) - 3  # (python_api/config/settings/base.py - 3 = python_api/)
APPS_DIR = ROOT_DIR.path('python_api')

# Load operating system environment variables and then prepare to use them
env = environ.Env()

# .env file, should load only in development environment
READ_DOT_ENV_FILE = env.bool('DJANGO_READ_DOT_ENV_FILE', default=False)

if READ_DOT_ENV_FILE:
    # Operating System Environment variables have precedence over variables defined in the .env file,
    # that is to say variables from the .env files will only be used if not defined
    # as environment variables.
    env_file = str(ROOT_DIR.path('.env'))
    print('Loading : {}'.format(env_file))
    env.read_env(env_file)
    print('The .env file has been loaded. See base.py for more information')

# APP CONFIGURATION
# ------------------------------------------------------------------------------
コード例 #17
0
Generated by 'django-admin startproject' using Django 1.9.6.

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

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

import os
import sys
import environ

from pythonjsonlogger import jsonlogger

root = environ.Path(__file__) - 2  # three folder back (/a/b/c/ - 3 = /)
env = environ.Env(DEBUG=(bool, False), )  # set default values and casting
environ.Env.read_env('{0}.env'.format(env('APP_ENV')))  # reading .env file

# 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.9/howto/deployment/checklist/
EMAIL_HOST = env('EMAIL_HOST')
EMAIL_PORT = env.int('EMAIL_PORT')
EMAIL_SUBJECT_PREFIX = '[brp]'
FORCE_SCRIPT_NAME = env('FORCE_SCRIPT_NAME')
SECRET_KEY = env('SECRET_KEY')

ALLOWED_HOSTS = env.list('ALLOWED_HOSTS', [])
コード例 #18
0
ファイル: base.py プロジェクト: dev4us/Instagram_dev4us
"""
Base settings to build other settings files upon.
"""

import environ

ROOT_DIR = environ.Path(__file__) - 3  # (instagram_dev4us/config/settings/base.py - 3 = instagram_dev4us/)
APPS_DIR = ROOT_DIR.path('instagram_dev4us')

env = environ.Env()

READ_DOT_ENV_FILE = env.bool('DJANGO_READ_DOT_ENV_FILE', default=False)
if READ_DOT_ENV_FILE:
    # OS environment variables take precedence over variables from .env
    env.read_env(str(ROOT_DIR.path('.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 = 'Asia/Seoul'
# 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
USE_I18N = True
コード例 #19
0
"""
Django settings for Project Name project.

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

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

ROOT_DIR = environ.Path(
    __file__
) - 3  # (rajukADA_django/config/settings/base.py - 3 = rajukADA_django/)
APPS_DIR = ROOT_DIR.path('rajukADA_django')

# Load operating system environment variables and then prepare to use them
env = environ.Env()

# .env file, should load only in development environment
READ_DOT_ENV_FILE = env.bool('DJANGO_READ_DOT_ENV_FILE', default=False)

if READ_DOT_ENV_FILE:
    # Operating System Environment variables have precedence over variables defined in the .env file,
    # that is to say variables from the .env files will only be used if not defined
    # as environment variables.
    env_file = str(ROOT_DIR.path('.env'))
    print('Loading : {}'.format(env_file))
    env.read_env(env_file)
    print('The .env file has been loaded. See base.py for more information')
コード例 #20
0
ファイル: base.py プロジェクト: CirclesUBI/safe-relay-service
import environ
import socket

ROOT_DIR = environ.Path(
    __file__
) - 3  # (safe_relay_service/config/settings/base.py - 3 = safe-relay-service/)
APPS_DIR = ROOT_DIR.path('safe_relay_service')

env = environ.Env()

READ_DOT_ENV_FILE = env.bool('DJANGO_READ_DOT_ENV_FILE', default=False)
DOT_ENV_FILE = env('DJANGO_DOT_ENV_FILE', default=None)
if READ_DOT_ENV_FILE or DOT_ENV_FILE:
    DOT_ENV_FILE = DOT_ENV_FILE or '.env'
    # OS environment variables take precedence over variables from .env
    env.read_env(str(ROOT_DIR.path(DOT_ENV_FILE)))

# GENERAL

DEBUG = env.bool('DJANGO_DEBUG', False)
TIME_ZONE = 'UTC'
LANGUAGE_CODE = 'en-us'
SITE_ID = 1
USE_I18N = True
USE_L10N = True
USE_TZ = True

# DATABASES

psql_url = 'psql://' + env('POSTGRES_USER') + ':' + env(
    'POSTGRES_PASSWORD') + '@' + env('POSTGRES_HOST') + ':' + env(
コード例 #21
0
ファイル: base.py プロジェクト: sam-mi/matific-the-voice
import environ


SITE_NAME = 'The Voice'
SCHEME = "https://"
SITE_DOMAIN = "thevoice.com"
SITE_URL = '{}{}'.format(SCHEME,SITE_DOMAIN)
SITE_DESCRIPTION = "A System to Track the Performance of Participants in The Voice"

COMPANY_ADDRESS = 'Sydney, Australia'
COMPANY_LOGO = '/static/images/logo.png'

AUTHOR = "Pure Creative"
AUTHOR_URL = "https://purecreative.digital"

ROOT_DIR = environ.Path(__file__) - 3  # (the_voice/config/settings/base.py - 3 = thevoice.com/the_voice/)
APPS_DIR = ROOT_DIR.path('the_voice')
BASE_DIR = str(ROOT_DIR.path())

# Load operating system environment variables and then prepare to use them
env = environ.Env()

# DEBUG
# ------------------------------------------------------------------------------
# See: https://docs.djangoproject.com/en/dev/ref/settings/#debug
DEBUG = env.bool('DJANGO_DEBUG', default=True)

# .env file, should load only in development environment
READ_DOT_ENV_FILE = env.bool('DJANGO_READ_DOT_ENV_FILE', default=not DEBUG)

コード例 #22
0
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
import json
from sys import platform
from django.core.exceptions import ImproperlyConfigured
import environ

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

with open(os.path.join(os.path.dirname(BASE_DIR), "secrets.json")) as f:
    secrets = json.loads(f.read())

def get_secret(setting, secrets=secrets):
    """Get the secret variable or return explicit exception."""
    try:
        return secrets[setting]
    except KeyError:
        error_msg = "Definir la variable de ambiente {0}".format(setting)
        raise ImproperlyConfigured(error_msg)
# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/3.0/howto/deployment/checklist/
コード例 #23
0
ファイル: settings.py プロジェクト: markusbkoch/web
from django.utils.translation import gettext_noop

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

from boto3.session import Session
from easy_thumbnails.conf import Settings as easy_thumbnails_defaults

import warnings

warnings.filterwarnings("ignore", category=UserWarning, module='psycopg2')

root = environ.Path(__file__) - 2  # Set the base directory to two levels.
env = environ.Env(DEBUG=(bool, False), )  # set default values and casting
env.read_env(str(root.path('app/.env')))  # reading .env file

DEBUG = env.bool('DEBUG', default=True)
QUESTS_LIVE = True
ENV = env('ENV', default='local')
DEBUG_ENVS = env.list('DEBUG_ENVS', default=['local', 'stage', 'test'])
IS_DEBUG_ENV = ENV in DEBUG_ENVS
HOSTNAME = env('HOSTNAME', default=socket.gethostname())
BASE_URL = env('BASE_URL', default='http://*****:*****@todo.net')))
BASE_DIR = root()
コード例 #24
0
ファイル: base.py プロジェクト: notaswinav/invento18
"""
Base settings for Invento18 project.

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

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

ROOT_DIR = environ.Path(
    __file__) - 3  # (invento18/config/settings/base.py - 3 = invento18/)
APPS_DIR = ROOT_DIR.path('invento18')

# Load operating system environment variables and then prepare to use them
env = environ.Env()

# .env file, should load only in development environment
READ_DOT_ENV_FILE = env.bool('DJANGO_READ_DOT_ENV_FILE', default=False)

if READ_DOT_ENV_FILE:
    # Operating System Environment variables have precedence over variables defined in the .env file,
    # that is to say variables from the .env files will only be used if not defined
    # as environment variables.
    env_file = str(ROOT_DIR.path('.env'))
    print('Loading : {}'.format(env_file))
    env.read_env(env_file)
    print('The .env file has been loaded. See base.py for more information')

# APP CONFIGURATION
コード例 #25
0
ファイル: base.py プロジェクト: RealMadJack/novel2read
"""
Base settings to build other settings files upon.
"""

import environ

ROOT_DIR = environ.Path(
    __file__) - 3  # (novel2read/config/settings/base.py - 3 = novel2read/)
APPS_DIR = ROOT_DIR.path('novel2read')

env = environ.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.path('.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 = 'Europe/Moscow'
# 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
コード例 #26
0
"""
Base settings to build other settings files upon.
"""

import environ

ROOT_DIR = environ.Path(
    __file__) - 3  # (education/config/settings/base.py - 3 = education/)
APPS_DIR = ROOT_DIR.path('education')

env = environ.Env()

READ_DOT_ENV_FILE = env.bool('DJANGO_READ_DOT_ENV_FILE', default=False)
if READ_DOT_ENV_FILE:
    # OS environment variables take precedence over variables from .env
    env.read_env(str(ROOT_DIR.path('.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
コード例 #27
0
import environ

env = environ.Env()
base = environ.Path(__file__) - 2
environ.Env.read_env(env_file=base('.env'))
HOST = env.str('MONGO_HOST')
PORT = env.int('MONGO_PORT')
DATABASE = env.str('MONGO_DB_NAME')

from pymongo import MongoClient

connection = MongoClient(HOST, PORT)  #Connect to mongodb
db = connection[DATABASE]
if 'django_apscheduler_djangojob' in db.list_collection_names():
    default_app_config = 'apl_api.apps.AplApiConfig'
コード例 #28
0
ファイル: base.py プロジェクト: Ianmuhia/cookiecutter_test
"""
Base settings to build other settings files upon.
"""

import environ

ROOT_DIR = (
    environ.Path(__file__) - 3
)  # (cookie_test_api/config/settings/base.py - 3 = cookie_test_api/)
APPS_DIR = ROOT_DIR.path("cookie_test_api")

env = environ.Env()

READ_DOT_ENV_FILE = env.bool("DJANGO_READ_DOT_ENV_FILE", default=False)
if READ_DOT_ENV_FILE:
    # OS environment variables take precedence over variables from .env
    env.read_env(str(ROOT_DIR.path(".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
コード例 #29
0
import os
import environ

env = environ.Env()
root = environ.Path(__file__) - 2
env.read_env()
BASE_DIR = root()

PROJECT_ROOT = os.path.abspath(
    os.path.join(os.path.dirname(__file__), os.pardir))
PACKAGE_ROOT = os.path.abspath(os.path.dirname(__file__))
BASE_DIR = root()

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

DATABASES = {
    'default':
    env.db('DATABASE_URL',
           default='psql://*****:*****@localhost:5432/pyconar')
}

ALLOWED_HOSTS = [
    "*",
]

# 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.
# On Unix systems, a value of None will cause Django to use the same
# timezone as the operating system.
# If running in a Windows environment this must be set to the same as your
コード例 #30
0
ファイル: base.py プロジェクト: pavlovicr/bac
"""
Django settings for BAC project.

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

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

ROOT_DIR = environ.Path(
    __file__) - 3  # (bac/config/settings/base.py - 3 = bac/)
APPS_DIR = ROOT_DIR.path('bac')

# Load operating system environment variables and then prepare to use them
env = environ.Env()

# .env file, should load only in development environment
READ_DOT_ENV_FILE = env.bool('DJANGO_READ_DOT_ENV_FILE', default=False)

if READ_DOT_ENV_FILE:
    # Operating System Environment variables have precedence over variables defined in the .env file,
    # that is to say variables from the .env files will only be used if not defined
    # as environment variables.
    env_file = str(ROOT_DIR.path('.env'))
    print('Loading : {}'.format(env_file))
    env.read_env(env_file)
    print('The .env file has been loaded. See base.py for more information')

# APP CONFIGURATION