from split_settings.tools import optional, include import os import socket if os.environ['DJANGO_SETTINGS_MODULE'] == 'example.settings': # must bypass this block if another settings module was specified include( "components/base.py", "components/locale.py", "components/apps_middleware.py", "components/static.py", "components/templates.py", "components/database.py", "components/logging.py", # OVERRIDE SETTINGS # hostname-based override, in settings/env/ directory optional("env/%s.py" % socket.gethostname().split(".", 1)[0]), # local settings (do not commit to version control) optional(os.path.join(os.getcwd(), "local_settings.py")), scope=locals() )
if SENTRY_DSN: import sentry_sdk from sentry_sdk.integrations.django import DjangoIntegration sentry_sdk.init( dsn=SENTRY_DSN, integrations=[DjangoIntegration()], environment=ENVIRONMENT, # Set traces_sample_rate to 1.0 to capture 100% # of transactions for performance monitoring. # We recommend adjusting this value in production, # Our current plan covers 10M transactions, our usage is ~30K per month traces_sample_rate=1.0, # If you wish to associate users to errors (assuming you are using # django.contrib.auth) you may enable sending PII data. send_default_pii=True, ) env_settings = f'{ENVIRONMENT.lower()}.py' include('defaults.py', 'crowdclick.py', optional('logging.py'), optional(env_settings if not TEST else None), optional('testing.py' if TEST else None), optional('local_optional.py' if not TEST else None), scope=locals())
# -*- coding: utf-8 -*- from split_settings.tools import optional, include include( # Components: 'components/base.py', 'components/locale.py', 'components/apps_middleware.py', 'components/static.py', 'components/templates.py', 'components/database.py', 'components/logging.py', # Override settings for testing: optional('components/testing.py'), # Missing file: optional('components/missing_file.py'), # Scope: scope=globals(), )
# 'components/pays.py', 'components/static.py', # 'components/social.py', # 'components/sentry.py', 'components/celery.py', # 'components/search.py', # 'components/notify.py', 'components/const.py', # 'components/db.py', # 'components/admin.py', # 'components/const.py', # 'components/cache.py', # 'components/email.py', # 'components/thumb.py', # 'components/store.py', optional('components/debug.py'), ) # DEBUG = env('DEBUG', default=True) # DEBUG = env.bool('DJANGO_DEBUG', default=True) # DEBUG = True # INSTALLED_APPS += ['django_cleanup.apps.CleanupConfig'] print('DEBUG:', DEBUG) # if DEBUG: # STATICFILES_DIRS = [ # str(ROOT_DIR.path('assets/static')), # ] STATIC_ROOT = env('DJANGO_STATIC_ROOT',
For more information read this: https://github.com/sobolevn/django-split-settings To change settings file: `DJANGO_ENV=production python manage.py runserver` """ from os import environ from split_settings.tools import include, optional # Managing environment via DJANGO_ENV variable: environ.setdefault("DJANGO_ENV", "development") ENV = environ["DJANGO_ENV"] base_settings = [ "components/common.py", "components/logging.py", "components/csp.py", "components/caches.py", # You can even use glob: # 'components/*.py' # Select the right env: f"environments/{ENV}.py", # Optionally override some settings: optional("environments/local.py"), ] # Include settings: include(*base_settings)
from split_settings.tools import optional, include import os from os import environ ENV = environ.get("DJANGO_ENVIRONMENT") or 'development' DEBUG = False if ENV == 'production' else True base_settings = [ os.path.join('environment', '{0}.py'.format(ENV)), os.path.join('components', '*.py'), # for any local settings optional('local_settings.py') ] include(*base_settings)
# -*- coding: utf-8 -*- """ Settings for local development server which runs under Vagrant. """ # Import global settings to make it easier to extend settings. from django.conf.global_settings import * # pylint: disable=W0614,W0401 from split_settings.tools import include, optional include( 'components/shared/paths.py', 'components/vagrant/paths.py', 'components/shared/base.py', 'components/vagrant/base.py', optional('components/vagrant/private.py'), 'components/shared/sessions.py', 'components/shared/admin.py', scope=locals() )
from split_settings.tools import optional, include include( 'base/security.py', optional('local/security.py'), 'base/paths.py', 'base/middleware.py', 'base/apps.py', # TODO: add debug toolbar # 'base/debug_toolbar.py', 'base/static.py', # TODO: logging # 'base/logging.py', 'base/*.py', optional('local/*.py'), )
import django from split_settings.tools import optional, include # Must bypass this block if another settings module was specified. if os.environ['DJANGO_SETTINGS_MODULE'] == 'tests.settings': include( 'components/base.py', 'components/locale.py', 'components/apps_middleware.py', 'components/static.py', 'components/templates.py', 'components/database.py', 'components/logging.py', # Override settings for testing: optional('components/testing.py'), # Missing file: optional('components/missing_file.py'), # hostname-based override, in settings/env/ directory # optional('env/%s.py' % socket.gethostname().split('.', 1)[0]), # local settings (do not commit to version control) # optional(os.path.join(os.getcwd(), 'local_settings.py')), scope=globals() )
from split_settings.tools import optional, include # Settings are split using split_settings: # https://github.com/sobolevn/django-split-settings # # * Universal settings for openbare live in settings.base. # * All local settings are imported as well, and supercede base settings. # Keep your dev settings here. A template is provided for getting you started: # settings/local_development.py.template # * System-wide settings not appropriate for settings.base belong in # /etc/openbare/settings_*.py # * Templates are provided for public setting files for: # DB, Session Secret, AWS, Logging. include( "base.py", # was settings.py optional("local_*.py"), # def settings - ignored by git optional("/etc/openbare/settings_*.py"), # production settings scope=locals() )
from split_settings.tools import optional, include include("settings/base.py", "settings/database.py", optional("settings/local.py"), scope=globals())
from split_settings.tools import optional, include include( 'components/base.py', 'components/loggers.py', 'components/global.py', ## # Local should be after global.py in order to override production # values. optional('components/local.py'), 'components/end.py', scope=globals() )
import decimal from split_settings.tools import optional, include import os import socket decimal.getcontext().traps[decimal.FloatOperation] = True # Must bypass this block if another settings module was specified. if os.environ['DJANGO_SETTINGS_MODULE'] == 'ep_site.settings': local_dev_config = optional('components/env/empty.py') if ('RUN_EP_IN_HOST' in os.environ) or ('RUN_SECURE_IMPORTER_IN_HOST' in os.environ): local_dev_config = optional('components/env/dev-local.py') include( # local settings (do not commit to version control) optional(os.path.join(os.getcwd(), 'local_settings.py')), 'components/base.py', 'components/logging.py', 'components/celery.py', 'components/rest_framework.py', # Override settings for testing: # optional('components/testing.py'), # Missing file: # optional('components/missing_file.py'), # Assigned if EP/SECURE_IMPORTER are run on the host machine
from split_settings.tools import optional, include # See https://defectdojo.github.io/django-DefectDojo/getting_started/configuration/ for options # how to tune the configuration to your needs. include('settings.dist.py', optional('local_settings.py'))
Generated by 'django-admin startproject' using Django 2.1.5. 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 collections import OrderedDict import django from split_settings.tools import include, optional include('/etc/source_optics/conf.d/*.py', optional('local_settings.py')) #os.environ.setdefault("DJANGO_SETTINGS_MODULE", __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/2.1/howto/deployment/checklist/ # SECURITY WARNING: keep the secret key used in production secret! SECRET_KEY = '8p-v&-27ltkxkt4n8*fax#65qa3z1g-^%^^yvqe1^f=9mfs$(6' # SECURITY WARNING: don't run with debug turned on in production! DEBUG = True
# Configure a default UUID for development only. SYSTEM_UUID = '00000000-0000-0000-0000-000000000000' # Store a snapshot of default settings at this point before loading any # customizable config files. DEFAULTS_SNAPSHOT = {} this_module = sys.modules[__name__] for setting in dir(this_module): if setting == setting.upper(): DEFAULTS_SNAPSHOT[setting] = copy.deepcopy( getattr(this_module, setting)) # If there is an `/etc/tower/settings.py`, include it. # If there is a `/etc/tower/conf.d/*.py`, include them. include(optional('/etc/tower/settings.py'), scope=locals()) include(optional('/etc/tower/conf.d/*.py'), scope=locals()) ANSIBLE_VENV_PATH = "/venv/ansible" AWX_VENV_PATH = "/venv/awx" # If any local_*.py files are present in awx/settings/, use them to override # default settings for development. If not present, we can still run using # only the defaults. try: include(optional('local_*.py'), scope=locals()) except ImportError: traceback.print_exc() sys.exit(1) CLUSTER_HOST_ID = socket.gethostname()
from split_settings.tools import include, optional include( 'base/env.py', optional('local/env.py'), 'base/root.py', 'base/common.py', 'base/logging.py', optional('local/logging.py'), 'base/security.py', optional('local/security.py'), 'base/middleware.py', 'base/apps.py', 'base/*.py', optional('local/*.py'), )
from split_settings.tools import optional, include settings = ['base.py', optional('local.py')] include(*settings)
# -*- coding: utf-8 -*- from split_settings.tools import optional, include from components import CONFIG # To change settings file: # `python manage.py runserver --settings=django_orm_example.other_settings` if CONFIG['DJANGO_SETTINGS_MODULE'] == 'django_orm_example.settings': testing = bool(CONFIG['_DJANGO_TESTING']) base_settings = [ 'components/common.py', # 'components/constants.py', 'components/queues.py', ] if not testing: settings = base_settings + [ 'environments/production.py', optional('environments/development.py'), ] else: settings = base_settings + [ 'environments/testing.py', ] # Include settings for the current env: include(*settings, scope=globals())
To change settings file: `DJANGO_ENV=production python manage.py runserver` """ from os import environ from split_settings.tools import optional, include # Managing environment via DJANGO_ENV variable: environ.setdefault('DJANGO_ENV', 'development') ENV = environ['DJANGO_ENV'] base_settings = [ 'components/common.py', 'components/logging.py', 'components/csp.py', 'components/caches.py', # You can even use glob: # 'components/*.py' # Select the right env: 'environments/{0}.py'.format(ENV), # Optionally override some settings: optional('environments/local.py'), ] # Include settings: include(*base_settings)
from split_settings.tools import optional, include include( # Load environment settings 'base/env.py', optional('local/env.py'), # We can "patch" any settings from local folder env.py file. # Here we should have the order because of dependencies 'base/paths.py', 'base/apps.py', 'base/middleware.py', 'base/debug_toolbar.py', # Load all other settings 'base/*.py', optional('local/*.py'), # we can load any other settings from local folder )
from split_settings.tools import optional, include include( 'components/base.py', 'components/pagination.py', optional('components/global.py'), ## # Local should be after product.py because if default value has not # been defined in the DATABASE dictionary then it must be defined. 'components/local.py', scope=globals() )
checked.append("'%s'" % filename) PROJECT_SETTINGS = os.path.join(PROJECT_DIR, filename) if os.path.exists(PROJECT_SETTINGS): break else: raise ImproperlyConfigured('No project settings found. Checked: ' + ', '.join(checked)) PROJECT_SETTINGS_DIR = os.path.dirname(PROJECT_SETTINGS) PROJECT_SETTINGS = [PROJECT_SETTINGS] # Convert to list # Override settings. OVERRIDE_SETTINGS = os.environ.get('OVERRIDE_SETTINGS') if not OVERRIDE_SETTINGS and 'DOTENV' in os.environ: OVERRIDE_SETTINGS = '%s.py' % os.environ['DOTENV'] if OVERRIDE_SETTINGS: BASE_SETTINGS.append(optional(OVERRIDE_SETTINGS)) PROJECT_SETTINGS.append( optional(os.path.join(PROJECT_SETTINGS_DIR, OVERRIDE_SETTINGS))) # Add Django compatibility to base settings. BASE_SETTINGS.append('django_compat.py') # Local settings. PROJECT_SETTINGS.append( optional(os.path.join(PROJECT_SETTINGS_DIR, 'local.py'))) # Tell users where settings are coming from. if os.environ.get('SHOW_SETTINGS', '').lower() in ('1', 't', 'true', 'y', 'yes'): print('BASE_SETTINGS (%s):\n %s' % ( os.path.dirname(__file__),
# -*- coding: utf-8 -*- from split_settings.tools import optional, include from components import CONFIG # To change settings file: # `python manage.py runserver --settings=to_deployother_settings` if CONFIG['DJANGO_SETTINGS_MODULE'] == 'to_deploy.settings': testing = bool(CONFIG['_DJANGO_TESTING']) base_settings = [ 'components/common.py', # 'components/constants.py', # 'components/queues.py', ] if not testing: settings = base_settings + [ 'environments/production.py', optional('environments/development.py'), ] else: settings = base_settings + [ 'environments/testing.py', ] # Include settings for the current env: include(*settings, scope=globals())
"""Settings package, including splitted settings files.""" from split_settings.tools import optional, include include( 'auth.py', 'base.py', 'database.py', 'email.py', 'graphene.py', 'i18n.py', 'templates.py', 'wsgi.py', optional('/etc/ciukune/settings.py') )
""" This is a django-split-settings main file. For more information read this: https://github.com/sobolevn/django-split-settings Default environment is `development`. To change settings file: `DJANGO_ENV=production python manage.py runserver` """ from os import environ from split_settings.tools import include, optional ENV = environ.get('DJANGO_ENV') or 'development' base_settings = [ 'common.py', # standard django settings # 'database.py', # postgres # You can even use glob: # '*.py' # Select the right env: '{0}.py'.format(ENV), # Optionally override some settings: optional('local.py'), ] # Include settings: include(*base_settings)
from split_settings.tools import optional, include include( 'base.py', 'assets.py', 'apps.py', 'cms.py', 'placeholders.py', 'ckeditor.py', '_{{ project_name }}_dev.py', optional('local.py'), scope=globals() )
# -*- coding: utf-8 -*- """ Settings for production platforms which serves real projects. """ # Import global settings to make it easier to extend settings. from django.conf.global_settings import * # pylint: disable=W0614,W0401 from split_settings.tools import include, optional include( 'components/shared/paths.py', optional('components/production/paths.py'), 'components/shared/base.py', optional('components/production/base.py'), 'components/shared/sessions.py', 'components/shared/admin.py', scope=locals() )
from split_settings.tools import optional, include import os # Build paths inside the project like this: os.path.join(BASE_DIR, ...) BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) include('settings_components/application.py', 'settings_components/database.py', 'settings_components/production.py', optional('settings_components/local.py'))
from split_settings.tools import optional, include import os env = os.environ.get('BASIL_ENV') or 'development' include( '{}.py'.format(env), optional('local.py') # allow additional local settings )
# Load settings from any .py files in the global conf.d directory specified in # the environment, defaulting to /etc/tower/conf.d/. settings_dir = os.environ.get('AWX_SETTINGS_DIR', '/etc/tower/conf.d/') settings_files = os.path.join(settings_dir, '*.py') # Load remaining settings from the global settings file specified in the # environment, defaulting to /etc/tower/settings.py. settings_file = os.environ.get('AWX_SETTINGS_FILE', '/etc/tower/settings.py') MIDDLEWARE_CLASSES = ( 'awx.main.middleware.MigrationRanCheckMiddleware', ) + MIDDLEWARE_CLASSES # Attempt to load settings from /etc/tower/settings.py first, followed by # /etc/tower/conf.d/*.py. try: include(settings_file, optional(settings_files), scope=locals()) except ImportError: traceback.print_exc() sys.exit(1) except IOError: from django.core.exceptions import ImproperlyConfigured included_file = locals().get('__included_file__', '') if (not included_file or included_file == settings_file): # The import doesn't always give permission denied, so try to open the # settings file directly. try: e = None open(settings_file) except IOError as e: pass if e and e.errno == errno.EACCES:
FONTAWESOME_5_PREFIX = "fa" # Treat wishes as seperate category in submission views? WISHES_AS_CATEGORY = True FOOTER_INFO = { "repo_url": "https://gitlab.fachschaften.org/kif/akplanning", "impress_text": "", "impress_url": "" } # How many AKs should be visible as next AKs PLAN_MAX_NEXT_AKS = 10 # Specify range of plan for screen/projector view PLAN_WALL_HOURS_RETROSPECT = 3 # Should the plan use a hierarchy of buildings and rooms? PLAN_SHOW_HIERARCHY = True # For which time (in seconds) should changes of akslots be highlighted in plan? PLAN_MAX_HIGHLIGHT_UPDATE_SECONDS = 2 * 60 * 60 # Show feed of recent changes in dashboard DASHBOARD_SHOW_RECENT = True # How many entries max? DASHBOARD_RECENT_MAX = 25 # Registration/login behavior SIMPLE_BACKEND_REDIRECT_URL = "/user/" LOGIN_REDIRECT_URL = SIMPLE_BACKEND_REDIRECT_URL include(optional("settings/*.py"))
# -*- coding: utf-8 -*- import os from split_settings.tools import optional, include include( 'base.py', 'rest_framework.py', 'lambdock_api.py', optional('local_settings.py'), scope=locals() )
from split_settings.tools import optional, include include( 'settings/base.py', optional('settings/local_settings.py'), )
from split_settings.tools import optional, include include( 'components/base.py', 'components/pagination.py', optional('components/global.py'), ## # Local should be after product.py because if default value has not # been defined in the DATABASE dictionary then it must be defined. 'components/local.py', scope=globals())
from split_settings.tools import optional, include import os DJANGO_ENV = os.environ.get('DJANGO_ENV', default='devel') base_settings = ( 'components/common.py', 'components/apps.py', 'components/sentry.py', 'components/logging.py', 'components/services.py', 'components/third_party_apps.py', optional('environments/%s.py' % DJANGO_ENV), ) include(*base_settings)
from split_settings.tools import include, optional include( "base.py", "database.py", "dramatiq.py", "dramatiq_tasks_manager.py", "restframework.py", "logging.py", optional("local_settings.py"), )
# -*- coding: utf-8 -*- import os import sys from split_settings.tools import optional, include SITE_ROOT = os.path.dirname(os.path.dirname(os.path.dirname(__file__))) APP_ROOT = os.path.join(SITE_ROOT, 'app') sys.path.insert(0, APP_ROOT) # gettext = lambda s: s _ = gettext # dev & test RUNNING_DEVSERVER = (len(sys.argv) > 1 and sys.argv[1] == 'runserver') include( 'components/base.py', 'components/template.py', # optional local settings optional(os.path.join(APP_ROOT, 'local_settings.py')), # via server based settings in etc (placed by ansible deployment tasks) optional('/etc/preflight-api/application-settings.py'), optional('/etc/preflight-api/logging.py'), scope=locals())
'PLUGIN_AUTH_LDAP': 'plugins/ldap.py', 'PLUGIN_LDAP_USER_SEARCH': 'plugins/ldap_user_search.py', } # This allows plugins to be enabled via environment variables. Can alternatively # add the relevant configs to local_settings.py for key, pc in plugin_configs.items(): if ENV.bool(key, default=False): coldfront_configs.append(pc) # Local settings overrides local_configs = [ # Local settings relative to coldfront.config package 'local_settings.py', # System wide settings for production deployments '/etc/coldfront/local_settings.py', # Local settings relative to coldfront project root PROJECT_ROOT('local_settings.py') ] if ENV.str('COLDFRONT_CONFIG', default='') != '': # Local settings from path specified via environment variable local_configs.append(environ.Path(ENV.str('COLDFRONT_CONFIG'))()) for lc in local_configs: coldfront_configs.append(optional(lc)) include(*coldfront_configs)
# -*- coding: utf-8 -*- """ Settings for staging platforms which serves project builds. """ # Import global settings to make it easier to extend settings. from django.conf.global_settings import * # pylint: disable=W0614,W0401 from split_settings.tools import include, optional include( 'components/shared/paths.py', 'components/staging/paths.py', 'components/shared/base.py', 'components/staging/base.py', optional('components/staging/private.py'), 'components/shared/sessions.py', 'components/shared/admin.py', scope=locals() )
from split_settings.tools import optional, include include('base.py', 'database.py', optional('local_settings.py'))
}, { 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator', }, ] # Internationalization # https://docs.djangoproject.com/en/2.2/topics/i18n/ LANGUAGE_CODE = 'en-us' TIME_ZONE = 'UTC' USE_I18N = True USE_L10N = True USE_TZ = True # Static files (CSS, JavaScript, Images) # https://docs.djangoproject.com/en/2.2/howto/static-files/ STATIC_URL = '/static/' STATIC_ROOT = os.path.join(BASE_DIR, 'static') include( optional('secrets.py'), optional('local_settings.py'), )
# -*- coding: utf-8 -*- """ Settings for production platforms which serves real projects. """ # Import global settings to make it easier to extend settings. from django.conf.global_settings import * # pylint: disable=W0614,W0401 from split_settings.tools import include, optional include('components/shared/paths.py', optional('components/production/paths.py'), 'components/shared/base.py', optional('components/production/base.py'), 'components/shared/sessions.py', 'components/shared/admin.py', scope=locals())
from split_settings.tools import optional, include import os # import socket if os.environ["DJANGO_SETTINGS_MODULE"] == "{{cookiecutter.package_name}}.settings": # must bypass this block if another settings module was specified include( "components/base.py", "components/auth.py", "components/database.py", "components/locale.py", "components/apps_middleware.py", "components/static.py", "components/templates.py", "components/logging.py", "components/email.py", "components/celery.py", # custom app settings "components/app.py", # hostname-based override, in settings/env/ directory # optional("env/%s.py" % socket.gethostname().split(".", 1)[0]), # local settings (do not commit to version control) optional("local_settings.py"), scope=locals(), )