"context_processors": [ "django.template.context_processors.debug", "django.template.context_processors.request", "django.contrib.auth.context_processors.auth", "django.contrib.messages.context_processors.messages", ], }, }, ] WSGI_APPLICATION = "server.wsgi.application" ASGI_APPLICATION = "server.routing.application" # CACHES = {"default": env.cache_url()} layers_hosts = [] for addr in env.list("CHANNEL_LAYERS_URLS"): host, port = addr.split(":") layers_hosts.append((host, int(port))) del addr, host, port # CHANNEL_LAYERS = { # "default": { # "BACKEND": "channels_redis.core.RedisChannelLayer", # "CONFIG": { # # "hosts": [("127.0.0.1", 6379)], # "hosts": layers_hosts, # }, # }, # } CHANNEL_LAYERS = {
# LOCAL VARS ##################################### ROOT_DIR = Path(__file__) - 2 APPS_DIR = ROOT_DIR.path('apps') environ = Env() ##################################### # SECURITY SETTINGS ##################################### SECRET_KEY = environ('DJANGO_SECRET_KEY', default='CHANGEME!!!') DEBUG = environ.bool('DJANGO_DEBUG', False) ALLOWED_HOSTS = environ.list('DJANGO_ALLOWED_HOSTS', default=['www.yourdomain.com']) ##################################### # INSTALLED APPS ##################################### DJANGO_APPS = [ 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', ] THIRD_PARTY_APPS = [
import json import platform from json import JSONDecodeError from os import path from pathlib import Path from environ import Env env = Env() env.read_env() BASE_DIR = Path(__file__).resolve(strict=True).parent.parent SECRET_KEY = env.str('SECRET_KEY') ALLOWED_HOSTS = env.list('ALLOWED_HOSTS') DEBUG = True INSTALLED_APPS = [ 'recipe_db.apps.RecipeDbConfig', 'web_app.apps.WebAppConfig', 'django.contrib.humanize', 'web_app.apps.WebAppStaticFilesConfig', 'meta', ] try: import data_import INSTALLED_APPS.append('data_import.apps.DataImportConfig') except ModuleNotFoundError: pass
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',
# If True, the django-modeltranslation will be added to the # INSTALLED_APPS setting. USE_MODELTRANSLATION = False ######################## # MAIN DJANGO SETTINGS # ######################## SECRET_KEY = env.str('SECRET_KEY', default='') NEVERCACHE_KEY = env.str('NEVERCACHE_KEY', default='') # Hosts/domain names that are valid for this site; required if DEBUG is False # See https://docs.djangoproject.com/en/dev/ref/settings/#allowed-hosts ALLOWED_HOSTS = env.list('ALLOWED_HOSTS', default=[]) # 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 # system time zone. TIME_ZONE = env.str('TIME_ZONE', default='UTC') # If you set this to True, Django will use timezone-aware datetimes. USE_TZ = env.bool('USE_TZ', default=True) # Language code for this installation. All choices can be found here: # http://www.i18nguy.com/unicode/language-identifiers.html
# INSTALLED_APPS setting. USE_MODELTRANSLATION = False # SEARCH_MODEL_CHOICES = ( # 'coverPage.CoverPage', # ) # Search for everything! SEARCH_MODEL_CHOICES = None ######################## # MAIN DJANGO SETTINGS # ######################## # Hosts/domain names that are valid for this site; required if DEBUG is False # See https://docs.djangoproject.com/en/dev/ref/settings/#allowed-hosts ALLOWED_HOSTS = ENV.list("ALLOWED_HOSTS", default=["localhost", "127.0.0.1", "::1"]) def show_toolbar(request): return ENV.bool("SHOW_DEBUG_TOOLBAR", default=False) DEBUG_TOOLBAR_CONFIG = {"SHOW_TOOLBAR_CALLBACK": show_toolbar} # 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 # system time zone.
from inloop.accounts import constance as accounts_constance from inloop.gitload import constance as gitload_constance from inloop.solutions import constance as solutions_constance if sys.getfilesystemencoding() != 'utf-8': raise ImproperlyConfigured('LANG must be a utf-8 locale') PACKAGE_DIR = Path(__file__).resolve().parent BASE_DIR = PACKAGE_DIR.parent env = Env() SECRET_KEY = env('SECRET_KEY') DEBUG = env.bool('DEBUG', default=False) ALLOWED_HOSTS = [host.strip() for host in env.list('ALLOWED_HOSTS')] INTERNAL_IPS = [ip.strip() for ip in env.list('INTERNAL_IPS', default='')] SITE_ID = 1 INSTALLED_APPS = [ 'inloop.accounts', 'inloop.common', 'inloop.grading', 'inloop.solutions', 'inloop.tasks', 'inloop.testrunner', 'inloop.gitload', 'inloop.statistics', 'inloop.medics', 'django.contrib.admin',
CACHES = {"default": ENV.cache_url(default="dummycache://")} AUTHENTICATION_BACKENDS = ("boltstream.auth.UsernameOrEmailModelBackend", ) AUTH_USER_MODEL = "boltstream.User" AUTH_PROFILE_MODEL = "boltstream.Profile" SESSION_ENGINE = ENV.str("SESSION_ENGINE", "django.contrib.sessions.backends.signed_cookies") SESSION_COOKIE_HTTPONLY = True SESSION_COOKIE_NAME = ENV.str("SESSION_COOKIE_NAME", "sessionid") SESSION_COOKIE_DOMAIN = ENV.str("SESSION_COOKIE_DOMAIN", None) SESSION_COOKIE_SECURE = ENV.bool("REQUIRE_HTTPS", not DEBUG) CSRF_USE_SESSIONS = True CSRF_TRUSTED_ORIGINS = ENV.list("CSRF_TRUSTED_ORIGINS", default=[]) if SESSION_COOKIE_DOMAIN: CSRF_TRUSTED_ORIGINS.append(SESSION_COOKIE_DOMAIN) LOGIN_URL = "/sign-in" LOGIN_REDIRECT_URL = "/" LOGOUT_REDIRECT_URL = "/sign-in" # SECURE_SSL_REDIRECT = ENV.bool("REQUIRE_HTTPS", not DEBUG) MESSAGE_STORAGE = "django.contrib.messages.storage.session.SessionStorage" MESSAGE_TAGS = {message_constants.ERROR: "danger"} # CORS CORS_ORIGIN_ALLOW_ALL = False CORS_ALLOW_CREDENTIALS = False
DEBUG=(bool, False) ) # Load PaaS Service env vars VCAP_SERVICES = env.json('VCAP_SERVICES', default={}) # 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("SECRET_KEY") # SECURITY WARNING: don't run with debug turned on in production! DEBUG = env("DEBUG") ALLOWED_HOSTS = env.list('ALLOWED_HOSTS', default=[]) # Application definition ELASTIC_APM_ENABLED = env("ELASTIC_APM_ENABLED", default=not DEBUG) if ELASTIC_APM_ENABLED: ELASTIC_APM = { "SERVICE_NAME": "market-access-pyfe", "SECRET_TOKEN": env("ELASTIC_APM_SECRET_TOKEN"), "SERVER_URL": env("ELASTIC_APM_URL"), "ENVIRONMENT": env("ENVIRONMENT", default="dev"), } BASE_APPS = [ # apps that need to load first 'whitenoise.runserver_nostatic',
import os from environ import Env BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) env = Env() envfile = os.path.join(BASE_DIR, ".env") if os.path.isfile(envfile): env.read_env(envfile) DEBUG = env.bool("DEBUG", default=False) SECRET_KEY = env.str("SECRET_KEY", default=("nom" * 20 if DEBUG else Env.NOTSET)) ALLOWED_HOSTS = env.list("ALLOWED_HOST", default=["*"]) APPEND_SLASH = True AUTH_USER_MODEL = "safka.User" LANGUAGE_CODE = "en-us" ROOT_URLCONF = "safka_project.urls" STATIC_URL = "/static/" TIME_ZONE = "UTC" USE_I18N = True USE_L10N = True USE_TZ = True WSGI_APPLICATION = "safka_project.wsgi.application" CAVALRY_ENABLED = bool(DEBUG) INSTALLED_APPS = [ "django.contrib.admin", "django.contrib.auth", "django.contrib.contenttypes", "django.contrib.sessions",
ENV_FILE = os.path.join(BASE_DIR, ".env") if os.path.exists(ENV_FILE): Env.read_env(ENV_FILE) env = 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 = env.str("DJANGO_SECRET_KEY") # SECURITY WARNING: don't run with debug turned on in production! DEBUG = env.bool("DEBUG", False) ALLOWED_HOSTS = env.list("ALLOWED_HOSTS", default=[]) # django-allow-cidr ALLOWED_CIDR_NETS = ["10.0.0.0/8"] WSGI_APPLICATION = "conf.wsgi.application" INSTALLED_APPS = [ "django.contrib.sessions", "django.contrib.messages", "django.contrib.staticfiles", "django.contrib.humanize", "svg", "lite_forms", "health_check", "health_check.cache",
from inloop.accounts import constance as accounts_constance from inloop.gitload import constance as gitload_constance from inloop.solutions import constance as solutions_constance if sys.getfilesystemencoding() != "utf-8": raise ImproperlyConfigured("LANG must be a utf-8 locale") PACKAGE_DIR = Path(__file__).resolve().parent BASE_DIR = PACKAGE_DIR.parent env = Env() SECRET_KEY = env("SECRET_KEY") DEBUG = env.bool("DEBUG", default=False) ALLOWED_HOSTS = [host.strip() for host in env.list("ALLOWED_HOSTS")] INTERNAL_IPS = [ip.strip() for ip in env.list("INTERNAL_IPS", default="")] SITE_ID = 1 INSTALLED_APPS = [ "inloop.accounts", "inloop.common", "inloop.grading", "inloop.solutions", "inloop.tasks", "inloop.testrunner", "inloop.gitload", "django.contrib.admin", "django.contrib.auth", "django.contrib.contenttypes",
import os from environ import Env env = 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__))) # SECURITY WARNING: keep the secret key used in production secret! SECRET_KEY = env.str('SECRET_KEY', 'Rq77Yq9xtDjRtHyj') DEBUG = True ALLOWED_HOSTS = env.list('DJANGO_ALLOWED_HOSTS', default=['localhost', '127.0.0.1']) SYSTEM_FEE = 0.05 # in percents # Application definition INSTALLED_APPS = [ 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', 'backend.transactions', 'backend.api', 'frontend', 'rest_framework',
from environ import Env from .base import * # noqa: F401, F403 env = Env() SECRET_KEY = env.str("SECRET_KEY", default="keepitsecret") DEBUG = env.bool("DEBUG", default=False) ALLOWED_HOSTS = env.list("ALLOWED_HOSTS", default=["*"]) INTERNAL_IPS = env.list("INTERNAL_IPS", default=["172.21.0.1"]) DATABASES = {"default": env.db(default="sqlite:///db.sqlite")} TIME_ZONE = env.str("TIME_ZONE", default="UTC") LANGUAGE_CODE = env.str("LANGUAGE_CODE", default="en-us") STATIC_ROOT = env.str("STATIC_ROOT", default=f"{BASE_DIR}static/") # noqa: F405 STATIC_URL = env.str("STATIC_URL", default="/static/") MEDIA_ROOT = env.str("MEDIA_ROOT", default=f"{BASE_DIR}media/") # noqa: F405 MEDIA_URL = env.str("MEDIA_URL", default="/media/")
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: ALLOWED_HOSTS = ["*"] SECRET_KEY = secrets.token_urlsafe(32) else: ALLOWED_HOSTS = env.list("ALLOWED_HOSTS", default=["userchallenges.pydis.com"]) SECRET_KEY = env("SECRET_KEY") # Application definition INSTALLED_APPS = [ 'code_challenges.apps.main', 'django.contrib.admin', 'django.contrib.auth',
ENV_FILE = os.path.join(BASE_DIR, ".env") if os.path.exists(ENV_FILE): Env.read_env(ENV_FILE) env = 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 = env.str("DJANGO_SECRET_KEY") # SECURITY WARNING: don't run with debug turned on in production! DEBUG = env.bool("DEBUG", False) ALLOWED_HOSTS = env.list("ALLOWED_HOSTS", default=[]) # django-allow-cidr ALLOWED_CIDR_NETS = ["10.0.0.0/8"] WSGI_APPLICATION = "conf.wsgi.application" INSTALLED_APPS = [ "django.contrib.sessions", "django.contrib.messages", "django.contrib.staticfiles", "django.contrib.contenttypes", "django.contrib.auth", "django.contrib.humanize", "svg", "lite_forms",
# Read .env file 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 = env.str('SECRET_KEY') # SECURITY WARNING: don't run with debug turned on in production! DEBUG = env.bool('DEBUG', default=True) ALLOWED_HOSTS = env.list('ALLOWED_HOSTS', default=[]) # Application definition INSTALLED_APPS = [ 'api.v1', 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', 'rest_framework', 'dynamic_rest', ]
import os from environ import Env BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) # 读取环境变量,.env 文件采用 utf-8 编码 Env.read_env(open(os.path.join(BASE_DIR, '.env'), encoding='utf-8')) env = Env() ROOT_URLCONF = 'project.urls' WSGI_APPLICATION = 'project.wsgi.application' DEBUG = env.bool('DJANGO_DEBUG', True) ALLOWED_HOSTS = env.list('DJANGO_ALLOWED_HOSTS', default=[]) SECRET_KEY = env.str('DJANGO_SECRET_KEY', '7=w%b(0@#ojjb6egx7+ba!@rnq-pfs8mrue^-i(wm$gxag3e17') INSTALLED_APPS = [ 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', 'django_extensions', 'django_summernote', 'bootstrap3', 'apps.core', 'apps.blog', ]
'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', 'django.contrib.gis', 'raven.contrib.django.raven_compat', 'corsheaders', 'rest_framework', 'rest_framework.authtoken', 'rest_framework_gis', 'django_filters', 'parkkihubi', 'parkings', 'sanitized_dump', ] + env.list("EXTRA_INSTALLED_APPS", default=['parkkihubi_hel']) if DEBUG and TIER == 'dev': # shell_plus and other goodies INSTALLED_APPS.append("django_extensions") ############## # Middleware # ############## MIDDLEWARE = [ 'django.contrib.sessions.middleware.SessionMiddleware', 'corsheaders.middleware.CorsMiddleware', 'django.middleware.common.CommonMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'parkkihubi.middleware.AdminTimezoneMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware',
} ################### # CUSTOM SETTINGS # ################### LOGIN_URL = "/accounts/login/" # Django Solo settings SOLO_CACHE = "default" SOLO_CACHE_TIMEOUT = None # Solo cache never expires # Patch the schemes so it understands memcached (with a D) env.CACHE_SCHEMES.setdefault("memcached", Env.CACHE_SCHEMES["memcache"]) ALLOWED_HOSTS = env.list("ALLOWED_HOSTS") SECRET_KEY = env("SECRET_KEY") if env("EMAIL_URL", default=""): vars().update(env.email("EMAIL_URL")) if env("SERVER_EMAIL", default=""): SERVER_EMAIL = DEFAULT_FROM_EMAIL = env("SERVER_EMAIL") if env("CACHE_URL", default=""): CACHE_MIDDLEWARE_SECONDS = 60 SESSION_ENGINE = "django.contrib.sessions.backends.cache" CACHES = {"default": env.cache("CACHE_URL")} ADMINS = [x.split(":") for x in env.list("DJANGO_ADMINS", default=[])]
from inloop.accounts import constance as accounts_constance from inloop.gitload import constance as gitload_constance from inloop.solutions import constance as solutions_constance if sys.getfilesystemencoding() != "utf-8": raise ImproperlyConfigured("LANG must be a utf-8 locale") PACKAGE_DIR = Path(__file__).resolve().parent BASE_DIR = PACKAGE_DIR.parent env = Env() SECRET_KEY = env("SECRET_KEY") DEBUG = env.bool("DEBUG", default=False) ALLOWED_HOSTS = [host.strip() for host in env.list("ALLOWED_HOSTS")] INTERNAL_IPS = [ip.strip() for ip in env.list("INTERNAL_IPS", default="")] SITE_ID = 1 INSTALLED_APPS = [ "inloop.accounts", "inloop.common", "inloop.grading", "inloop.solutions", "inloop.tasks", "inloop.testrunner", "inloop.gitload", "django.contrib.admin", "django.contrib.auth",
GOV_NOTIFY_ENABLED=(bool, False), DOCUMENT_SIGNING_ENABLED=(bool, False), ) # 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") DEBUG = env("DEBUG") # Please use this to Enable/Disable the Admin site ADMIN_ENABLED = True ALLOWED_HOSTS = env.list("ALLOWED_HOSTS", default=[]) # django-allow-cidr ALLOWED_CIDR_NETS = ["10.0.0.0/8"] # Application definition INSTALLED_APPS = [ "api.addresses", "api.applications.apps.ApplicationsConfig", "api.audit_trail", "background_task", "api.cases", "api.cases.generated_documents", "api.compliance", "django.contrib.admin", "django.contrib.auth",