############################ # Environment variables ############################ DEV = config('DEV', default=False, cast=bool) DEBUG = config('DEBUG', default=False, cast=bool) ADMIN_ALIAS = config('ADMIN_ALIAS', default='*****@*****.**') ADMINS = (('Mozillians.org Admins', ADMIN_ALIAS), ) MANAGERS = ADMINS DOMAIN = config('DOMAIN', default='mozillians.org') PROTOCOL = config('PROTOCOL', default='https://') PORT = config('PORT', default=443, cast=int) SITE_URL = config('SITE_URL', default='https://mozillians.org') SECRET_KEY = config('SECRET_KEY', default='') ALLOWED_HOSTS = config('ALLOWED_HOSTS', default=DOMAIN, cast=Csv()) # Site ID is used by Django's Sites framework. SITE_ID = 1 HEALTHCHECKS_IO_URL = config('HEALTHCHECKS_IO_URL', default='') X_FRAME_OPTIONS = config('X_FRAME_OPTIONS', default='DENY') # Sessions SESSION_COOKIE_HTTPONLY = config('SESSION_COOKIE_HTTPONLY', default=True, cast=bool) SESSION_COOKIE_SECURE = config('SESSION_COOKIE_SECURE', default=True, cast=bool)
# -*- coding: utf-8 -*- import os from pathlib import Path from decouple import config, Csv # Build paths inside the project like this: BASE_DIR / 'subdir'. BASE_DIR = Path(__file__).resolve().parent.parent # SECURITY WARNING: keep the secret key used in production secret! SECRET_KEY = config('SECRET_KEY', '') # SECURITY WARNING: don't run with debug turned on in production! DEBUG = config('DEBUG', True) ALLOWED_HOSTS = config('ALLOWED_HOSTS', default=['127.0.0.1'], cast=Csv()) # Application definition INSTALLED_APPS = [ 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', 'django_static_fontawesome', 'apps.home', 'apps.login', ] MIDDLEWARE = [
import os from decouple import config, Csv # 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.0/howto/deployment/checklist/ # SECURITY WARNING: keep the secret key used in production secret! SECRET_KEY = config('SECRET_KEY') # SECURITY WARNING: don't run with debug turned on in production! DEBUG = config('DEBUG', cast=bool) ALLOWED_HOSTS = config('ALLOWED_HOSTS', cast=Csv()) # Application definition INSTALLED_APPS = [ 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', 'dashboard.apps.DashboardConfig', ] MIDDLEWARE = [ 'django.middleware.security.SecurityMiddleware',
import os from decouple import config, Csv from . base import * DEBUG = True # ALLOWED_HOSTS = ['quantanalyst.ch', 'www.quantanalyst.ch'] ALLOWED_HOSTS = config('ALLOWED_HOSTS_PRODUCTION_QUANTANALYST', cast=Csv()) # ALLOWED_HOSTS = config('ALLOWED_HOSTS_PRODUCTION_QUANTANALYST')
import sentry_sdk from sentry_sdk.integrations.django import DjangoIntegration 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 = config('SECRET_KEY') # SECURITY WARNING: don't run with debug turned on in production! DEBUG = config('DEBUG', cast=bool) ALLOWED_HOSTS = config('ALLOWED_HOSTS', cast=Csv()) # ['alexispersonal.herokuapp.com'] AUTH_USER_MODEL = 'base.User' # Application definition INSTALLED_APPS = [ 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'collectfast', 'django.contrib.staticfiles', 'pyalexis.base', 'pyalexis.videos',
# THUMBNAIL_BASEDIR = 'thumbs' # THUMBNAIL_ALIASES = { # '': { # 'avatar': { # 'size': (200, 200), # 'background': '#cccccc', # }, # }, # } # REST_FRAMEWORK = { # 'DEFAULT_AUTHENTICATION_CLASSES': [ # 'rest_framework.authentication.SessionAuthentication', # 'rest_framework.authentication.TokenAuthentication', # ] # } DEFAULT_FROM_EMAIL = config('DEFAULT_FROM_EMAIL', default='*****@*****.**') EMAIL_BCC_ADDRESSES = config('EMAIL_BCC_ADDRESSES', default='', cast=Csv()) PROJECT_CONFIGURATION = config('DJANGO_SETTINGS_MODULE', default='').split('.')[-1] USE_HTTPS = False # Google integration GOOGLE_TAG_MANAGER = os.environ.get('GOOGLE_TAG_MANAGER', '') # ELASTICSEARCH_URLS = config('ELASTICSEARCH_URLS', default='http://localhost:9200', cast=Csv()) # ELASTICSEARCH_INDICES_PREFIX = config('ELASTICSEARCH_INDICES_PREFIX', default=PROJECT_NAME) SITE_URL = config('SITE_URL', default='')
import re from decouple import config, Csv MGX_GET = 'https://wwwdev.ebi.ac.uk/ena/registry/metagenome/api/' \ 'sequences/{}/datasets' MGX_POST = 'https://wwwdev.ebi.ac.uk/ena/registry/metagenome/api/' \ 'admin/datasets' RUN_PATTERN = re.compile('^[EDS]RR[0-9]{6,7}$') SOURCE_PATTERN = re.compile(config('SOURCE_PATTERN')) BROKER_ID = config('BROKER_ID') AUTHORISATION_TOKEN = config('AUTHORISATION_TOKEN') SOURCE_ENDPOINT = config('SOURCE_ENDPOINT') PUBLIC_CHECK_ENDPOINT = config('PUBLIC_CHECK_ENDPOINT', default='') MAPPINGS_DOWNLOAD = config('MAPPINGS_DOWNLOAD') MAPPINGS_LOCAL = config('MAPPINGS_LOCAL') MAPPINGS_FORMAT = config('MAPPINGS_FORMAT', default='tsv') MAPPINGS_HEADER = config('MAPPINGS_HEADER', cast=bool) SOURCE_ID_COLUMN = config('SOURCE_ID_COLUMN', cast=int) INSDC_ID_COLUMN = config('INSDC_ID_COLUMN', cast=int) METHODS = config('METHODS', cast=Csv()) CONFIDENCE = config('CONFIDENCE')
BASKET_NDA_NEWSLETTER = config('BASKET_NDA_NEWSLETTER', default='mozillians-nda') BASKET_API_KEY = config('BASKET_API_KEY') NDA_GROUP = config('NDA_GROUP', default='nda') USER_AVATAR_DIR = config('USER_AVATAR_DIR', default='uploads/userprofile') MOZSPACE_PHOTO_DIR = config('MOZSPACE_PHOTO_DIR', default='uploads/mozspaces') ANNOUNCEMENTS_PHOTO_DIR = config('ANNOUNCEMENTS_PHOTO_DIR', default='uploads/announcements') ADMIN_EXPORT_MIXIN = config('ADMIN_EXPORT_MIXIN', default='mozillians.common.mixins.S3ExportMixin') # Google Analytics GA_ACCOUNT_CODE = config('GA_ACCOUNT_CODE', default='UA-35433268-19') # Akismet AKISMET_API_KEY = config('AKISMET_API_KEY', default='') ALLOWED_HOSTS = config('ALLOWED_HOSTS', default=DOMAIN, cast=Csv()) STRONGHOLD_EXCEPTIONS = ['^%s' % MEDIA_URL, '^/csp/', '^/admin/', '^/api/', '^/oidc/authenticate/', '^/oidc/callback/', # Allow autocomplete urls for profile registration '^/[\w-]+/skills-autocomplete/', '^/[\w-]+/country-autocomplete/', '^/[\w-]+/city-autocomplete/', '^/[\w-]+/region-autocomplete/', '^/[\w-]+/timezone-autocomplete/'] # Set default avatar for user profiles
def get_download_url(self, channel, version, platform, locale, force_direct=False, force_full_installer=False, force_funnelcake=False, funnelcake_id=None, locale_in_transition=False): """ Get direct download url for the product. :param channel: one of self.version_map.keys(). :param version: a firefox version. one of self.latest_version. :param platform: OS. one of self.platform_labels.keys(). :param locale: e.g. pt-BR. one exception is ja-JP-mac. :param force_direct: Force the download URL to be direct. always True for non-release URLs. :param force_full_installer: Force the installer download to not be the stub installer (for aurora). :param force_funnelcake: Force the download version for en-US Windows to be 'latest', which bouncer will translate to the funnelcake build. :param funnelcake_id: ID for the the funnelcake build. :param locale_in_transition: Include the locale in the transition URL :return: string url """ _version = version _locale = 'ja-JP-mac' if platform == 'osx' and locale == 'ja' else locale _platform = 'win' if platform == 'winsha1' else platform channel = 'devedition' if channel == 'alpha' else channel force_direct = True if channel != 'release' else force_direct stub_platforms = ['win', 'win64'] esr_channels = ['esr', 'esr_next'] include_funnelcake_param = False # Bug 1345467 - Only allow specifically configured funnelcake builds if funnelcake_id: fc_platforms = config('FUNNELCAKE_%s_PLATFORMS' % funnelcake_id, default='', cast=Csv()) fc_locales = config('FUNNELCAKE_%s_LOCALES' % funnelcake_id, default='', cast=Csv()) include_funnelcake_param = _platform in fc_platforms and _locale in fc_locales # Check if direct download link has been requested # if not just use transition URL if not force_direct: # build a link to the transition page transition_url = self.download_base_url_transition if funnelcake_id: # include funnelcake in scene 2 URL transition_url += '?f=%s' % funnelcake_id if locale_in_transition: transition_url = '/%s%s' % (locale, transition_url) return transition_url # otherwise build a full download URL prod_name = 'firefox' if channel == 'release' else 'firefox-%s' % channel suffix = 'latest-ssl' if channel in esr_channels: # nothing special about ESR other than there is no stub. # included in this contitional to avoid the following elif. if channel == 'esr_next': # no firefox-esr-next-latest-ssl alias just yet # could come in future in bug 1408868 prod_name = 'firefox' suffix = '%s-SSL' % _version elif _platform in stub_platforms and not force_full_installer: # Use the stub installer for approved platforms # append funnelcake id to version if we have one if include_funnelcake_param: suffix = 'stub-f%s' % funnelcake_id else: suffix = 'stub' elif channel == 'nightly' and locale != 'en-US': # Nightly uses a different product name for localized builds, # and is the only one ಠ_ಠ suffix = 'latest-l10n-ssl' product = '%s-%s' % (prod_name, suffix) return '?'.join([ self.get_bouncer_url(platform), urlencode([ ('product', product), ('os', _platform), # Order matters, lang must be last for bouncer. ('lang', _locale), ]) ])
# from django.conf.urls import url # from django.core.checks import database 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 = config('SECRET_KEY') # SECURITY WARNING: don't run with debug turned on in production! DEBUG = config('DEBUG', cast=bool) ALLOWED_HOSTS = config('ALLOWED_HOSTS', cast=Csv()) # ['rpythonprodjango.herokuapp.com'] AUTH_USER_MODEL = 'base.User' # Application definition INSTALLED_APPS = [ 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'collectfast', 'django.contrib.staticfiles', 'pypro.base', 'pypro.aperitivos',
import telebot import markovify from decouple import config, Csv import dataset from cachetools.func import ttl_cache import logging logging.basicConfig(level=logging.INFO) logger = logging.getLogger(__name__) TELEGRAM_TOKEN = config('TELEGRAM_TOKEN', default='') ADMIN_USERNAMES = config('ADMIN_USERNAMES', default='', cast=Csv()) SENTENCE_COMMAND = config('SENTENCE_COMMAND', default='sentence') DATABASE_URL = config('DATABASE_URL', default='sqlite:///:memory:') MODEL_CACHE_TTL = config('MODEL_CACHE_TTL', default='300', cast=int) COMMIT_HASH = config('HEROKU_SLUG_COMMIT', default='not set') MESSAGE_LIMIT = config('MESSAGE_LIMIT', default='5000', cast=int) db = dataset.connect(DATABASE_URL)['messages'] bot = telebot.TeleBot(TELEGRAM_TOKEN) def is_from_admin(message): username = message.from_user.username chat_id = str(message.chat.id) username_admins = [ u.user.username for u in bot.get_chat_administrators(chat_id) ] return (username in username_admins + ADMIN_USERNAMES)
LANGUAGE_CODE = "en-US" # Absolute path to the directory that holds media. MEDIA_ROOT = path("media") # URL that handles the media served from MEDIA_ROOT. Make sure to use a # trailing slash if there is a path component (optional in other cases). MEDIA_URL = "/media/" # Absolute path to the directory static files should be collected to. STATIC_ROOT = config("STATIC_ROOT", path("static")) # URL prefix for static files STATIC_URL = "/static/" ALLOWED_HOSTS = config("ALLOWED_HOSTS", "", cast=Csv()) # Defines the views served for root URLs. ROOT_URLCONF = "crashstats.urls" INSTALLED_APPS = ( "pipeline", "django.contrib.contenttypes", "django.contrib.auth", "django.contrib.sessions", "django.contrib.staticfiles", "session_csrf", "django.contrib.admin.apps.SimpleAdminConfig", "mozilla_django_oidc", # Socorro apps "crashstats.crashstats",
] WSGI_APPLICATION = 'pypro.wsgi.application' # Configuração de envio de Email EMAIL_BACKEND = config('EMAIL_BACKEND') EMAIL_HOST = config('EMAIL_HOST') EMAIL_PORT = config('EMAIL_PORT') EMAIL_HOST_USER = config('EMAIL_HOST_USER') EMAIL_HOST_PASSWORD = config('EMAIL_HOST_PASSWORD') EMAIL_USE_TLS = config('EMAIL_USE_TLS') # Configuração Django Debug Toolbar INTERNAL_IPS = config('INTERNAL_IPS', cast=Csv(), default='127.0.0.1') if DEBUG: INSTALLED_APPS.append('debug_toolbar') MIDDLEWARE.insert(0, 'debug_toolbar.middleware.DebugToolbarMiddleware') # Database # https://docs.djangoproject.com/en/3.1/ref/settings/#databases default_db_url = 'sqlite:///' + os.path.join(BASE_DIR, 'db.sqlite3') parse_database = partial(dj_database_url.parse, conn_max_age=600) DEFAULT_AUTO_FIELD = 'django.db.models.AutoField' DATABASES = {
# Import `default` as the default settings. This can be handy while pushing items into tuples. import django.conf.global_settings as default # Quick-start development settings - unsuitable for production # See https://docs.djangoproject.com/en/1.8/howto/deployment/checklist/ # SECURITY WARNING: keep the secret key used in production secret! SECRET_KEY = config('SECRET_KEY', default='secret_key') API_KEY = config('API_KEY', default='apikey') # SECURITY WARNING: don't run with debug turned on in production! DEBUG = config('DEBUG', default=False, cast=bool) ALLOWED_HOSTS = config('ALLOWED_HOSTS', cast=Csv(lambda x: x.strip().strip(',').strip()), default='*') # Application definition INSTALLED_APPS = ( 'wikilegis.auth2', 'wikilegis.core', 'wikilegis.comments2', 'wikilegis.notification', 'flat', 'object_tools', 'export', 'django.contrib.admin', 'django.contrib.auth',
CACHES = { 'default': { 'BACKEND': 'django.core.cache.backends.locmem.LocMemCache', 'TIMEOUT': CACHE_COUNT_TIMEOUT, 'KEY_PREFIX': CACHE_PREFIX, }, 'memcache': { 'BACKEND': 'memcached_hashring.backend.MemcachedHashRingCache', 'TIMEOUT': CACHE_COUNT_TIMEOUT * 60, 'KEY_PREFIX': CACHE_PREFIX, 'LOCATION': config('MEMCACHE_SERVERS', default='127.0.0.1:11211', cast=Csv()), }, } CACHEBACK_CACHE_ALIAS = 'memcache' # Email vars().update( config('EMAIL_URL', default='console://', cast=dj_email_url.parse)) EMAIL_SUBJECT_PREFIX = '[mdn] ' # Addresses email comes from DEFAULT_FROM_EMAIL = '*****@*****.**' SERVER_EMAIL = '*****@*****.**' PLATFORM_NAME = platform.node()
import os from decouple import Csv, config # 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/3.0/howto/deployment/checklist/ # SECURITY WARNING: keep the secret key used in production secret! SECRET_KEY = config('SECRET_KEY') DEBUG = config('DEBUG', default=False, cast=bool) ALLOWED_HOSTS = config('ALLOWED_HOSTS', default=[], cast=Csv()) INTERNAL_IPS = config('INTERNAL_IPS', default=[], cast=Csv()) # Application definition INSTALLED_APPS = [ 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', 'django_extensions', 'rest_framework', 'drf_yasg',
import sentry_sdk from sentry_sdk.integrations.django import DjangoIntegration 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 = config('SECRET_KEY') # SECURITY WARNING: don't run with debug turned on in production! DEBUG = config('DEBUG', cast=bool) ALLOWED_HOSTS = config('ALLOWED_HOSTS', cast=Csv()) AUTH_USER_MODEL = 'base.User' # "qual é a app onde o modelo se encontra"<ponto>"o modelo" # AUTH_USER_MODEL = '<app>.<Model>' # é necessario essa variavel pois nao estamos utilizado o usuario padrão do django. Por isso precisamos informar qual # será a classe base usada como usuario LOGIN_REDIRECT_URL = '/modulos/' LOGOUT_REDIRECT_URL = '/' LOGIN_URL = '/contas/login/' # Application definition INSTALLED_APPS = [ 'modelodjango.base', 'modelodjango.segunda_app',
default=not DEBUG, cast=bool) SESSION_COOKIE_HTTPONLY = True SESSION_COOKIE_NAME = "session_id" SESSION_ENGINE = config("SESSION_ENGINE", default="django.contrib.sessions.backends.cache") SESSION_SERIALIZER = config( "SESSION_SERIALIZER", default="django.contrib.sessions.serializers.PickleSerializer") # CSRF CSRF_COOKIE_SECURE = config("CSRF_COOKIE_SECURE", default=not DEBUG, cast=bool) # # Connection information for Elastic 7 ES_TIMEOUT = 5 # Timeout for querying requests ES7_URLS = config("ES7_URLS", cast=Csv(), default="elasticsearch7:9200") ES7_CLOUD_ID = config("ES7_CLOUD_ID", default="") ES7_USE_SSL = config("ES7_USE_SSL", default=False, cast=bool) ES7_HTTP_AUTH = config("ES7_HTTP_AUTH", default="", cast=Csv()) ES7_ENABLE_CONSOLE_LOGGING = config("ES7_ENABLE_CONSOLE_LOGGING", default=False, cast=bool) # Pass parameters to the ES7 client # like "search_type": "dfs_query_then_fetch" ES7_SEARCH_PARAMS = {"request_timeout": ES_TIMEOUT} # This is prepended to index names to get the final read/write index # names used by kitsune. This is so that you can have multiple # environments pointed at the same ElasticSearch cluster and not have # them bump into one another. ES_INDEX_PREFIX = config("ES_INDEX_PREFIX", default="sumo")
def get_download_url(self, channel, version, platform, locale, force_direct=False, force_full_installer=False, force_funnelcake=False, funnelcake_id=None, locale_in_transition=False): """ Get direct download url for the product. :param channel: one of self.version_map.keys(). :param version: a firefox version. one of self.latest_version. :param platform: OS. one of self.platform_labels.keys(). :param locale: e.g. pt-BR. one exception is ja-JP-mac. :param force_direct: Force the download URL to be direct. :param force_full_installer: Force the installer download to not be the stub installer (for aurora). :param force_funnelcake: Force the download version for en-US Windows to be 'latest', which bouncer will translate to the funnelcake build. :param funnelcake_id: ID for the the funnelcake build. :param locale_in_transition: Include the locale in the transition URL :return: string url """ _version = version _locale = 'ja-JP-mac' if platform == 'osx' and locale == 'ja' else locale _platform = 'win' if platform == 'winsha1' else platform include_funnelcake_param = False # Bug 1345467 - Only allow specifically configured funnelcake builds if funnelcake_id: fc_platforms = config('FUNNELCAKE_%s_PLATFORMS' % funnelcake_id, default='', cast=Csv()) fc_locales = config('FUNNELCAKE_%s_LOCALES' % funnelcake_id, default='', cast=Csv()) include_funnelcake_param = _platform in fc_platforms and _locale in fc_locales stub_langs = settings.STUB_INSTALLER_LOCALES.get(channel, {}).get(_platform, []) # Nightly and Developer Edition have a special download link format # see bug 1324001, 1357379 if channel in ['alpha', 'nightly']: prod_name = 'firefox-nightly' if channel == 'nightly' else 'firefox-devedition' # Use the stub installer for approved platforms if (stub_langs and (stub_langs == settings.STUB_INSTALLER_ALL or _locale.lower() in stub_langs) and not force_full_installer): # Download links are different for localized versions suffix = 'stub' elif channel == 'nightly' and locale != 'en-US': # Nightly uses a different product name for localized builds suffix = 'latest-l10n-ssl' else: suffix = 'latest-ssl' product = '%s-%s' % (prod_name, suffix) return '?'.join([self.get_bouncer_url(platform), urlencode([ ('product', product), ('os', _platform), # Order matters, lang must be last for bouncer. ('lang', _locale), ])]) # stub installer exceptions if (stub_langs and (stub_langs == settings.STUB_INSTALLER_ALL or _locale.lower() in stub_langs) and not force_full_installer): suffix = 'stub' if force_funnelcake: suffix = 'latest' _version = ('beta-' if channel == 'beta' else '') + suffix elif not include_funnelcake_param: # Force download via SSL. Stub installers are always downloaded via SSL. # Funnelcakes may not be ready for SSL download _version += '-SSL' # append funnelcake id to version if we have one if include_funnelcake_param: _version = '{vers}-f{fc}'.format(vers=_version, fc=funnelcake_id) # Check if direct download link has been requested # (bypassing the transition page) if force_direct: # build a direct download link return '?'.join([self.get_bouncer_url(platform), urlencode([ ('product', 'firefox-%s' % _version), ('os', _platform), # Order matters, lang must be last for bouncer. ('lang', _locale), ])]) else: # build a link to the transition page transition_url = self.download_base_url_transition if funnelcake_id: # include funnelcake in scene 2 URL transition_url += '&f=%s' % funnelcake_id if locale_in_transition: transition_url = '/%s%s' % (locale, transition_url) return transition_url
For the full list of settings and their values, see https://docs.djangoproject.com/en/3.0/ref/settings/ """ import os from decouple import config, Csv from dj_database_url import parse as db_url BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) SECRET_KEY = config("SECRET_KEY") # SECURITY WARNING: don't run with debug turned on in production! DEBUG = config("DJANGO_DEBUG", default=False) ALLOWED_HOSTS = config("ALLOWED_HOSTS", cast=Csv(), default="*") INSTALLED_APPS = [ "django.contrib.admin", "django.contrib.auth", "django.contrib.contenttypes", "django.contrib.sessions", "django.contrib.messages", "django.contrib.staticfiles", "oauth2_provider", "apps.oauth2", "corsheaders", "apps.users", "crispy_forms", ]
from pathlib import Path # 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 = config("SECRET_KEY") # SECURITY WARNING: don't run with debug turned on in production! DEBUG = config("DEBUG", default=False, cast=bool) ALLOWED_HOSTS = config("ALLOWED_HOSTS", cast=Csv()) # Application definition INSTALLED_APPS = [ "django.contrib.admin", "django.contrib.auth", "django.contrib.contenttypes", "django.contrib.sessions", "django.contrib.messages", "django.contrib.staticfiles", # third party apps "rest_framework", "corsheaders", "django_filters",
# Build paths inside the project like this: os.path.join(BASE_DIR, ...) BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) PROJECT_DIR = Path(__file__).parent # SECURITY WARNING: keep the secret key used in production secret! SECRET_KEY = config("SECRET_KEY", default="S#perS3crEt_1122") SITE_ID = config("SITE_ID", default=1) # SECURITY WARNING: don't run with debug turned on in production! DEBUG = config("DEBUG", default=False, cast=bool) TEMPLATE_DEBUG = DEBUG # load production server from .env ALLOWED_HOSTS = config("ALLOWED_HOSTS", default="127.0.0.1, localhost", cast=Csv()) EMAIL_BACKEND = config("EMAIL_BACKEND", "django.core.mail.backends.console.EmailBackend") EMAIL_HOST = config("EMAIL_HOST", "NOT_THIS_ONE") EMAIL_USE_TLS = config("EMAIL_USE_TLS", "NOT_THIS_ONE") EMAIL_PORT = config("EMAIL_PORT", "NOT_THIS_ONE") EMAIL_HOST_USER = config("EMAIL_HOST_USER", "NOT_THIS_ONE") EMAIL_HOST_PASSWORD = config("EMAIL_HOST_PASSWORD", "NOT_THIS_ONE") # Application definition INSTALLED_APPS = [ "djangocms_admin_style", # for the admin skin. (CMS) "django.contrib.admin", "django.contrib.auth",
from .base_settings import * from decouple import config, Csv MAX_COMMAND_RATE = 1 # values to put in new settings file to maintain existing values: TELNET_PORTS = [3050] WEBSERVER_PORTS = [(8082, 5001)] WEBSOCKET_CLIENT_PORT = 8083 SSH_PORTS = [8022] SSL_PORTS = [4001] AMP_PORT = 5000 TELNET_INTERFACES = config('TELNET_INTERFACES', default='192.168.1.209', cast=Csv()) WEBSOCKET_CLIENT_INTERFACE = config('WEBSOCKET_CLIENT_INTERFACE', default='192.168.1.209') INTERNAL_IPS = ('127.0.0.1',) SITE_HEADER = "ArxTest Admin" INDEX_TITLE = "ArxTest Admin" IN_GAME_ERRORS = True INSTALLED_APPS += ('test_without_migrations',) ###################################################################### # Contrib config ###################################################################### GAME_INDEX_LISTING = { } DEBUG = True TEMPLATES[0]['OPTIONS']['debug'] = DEBUG
}, ] WSGI_APPLICATION = "config.wsgi.application" # Database # https://docs.djangoproject.com/en/3.1/ref/settings/#databases # TODO: Add to documentation that database keys should not be than 128 characters. # MATHESAR_DATABASES should be of the form '({db_name}|{db_url}), ({db_name}|{db_url})' # See pipe_delim above for why we use pipes as delimiters DATABASES = { db_key: db_url(url_string) for db_key, url_string in decouple_config('MATHESAR_DATABASES', cast=Csv(pipe_delim)) } DATABASES[decouple_config('DJANGO_DATABASE_KEY')] = decouple_config( 'DJANGO_DATABASE_URL', cast=db_url) for db_key, db_dict in DATABASES.items(): # Engine can be '.postgresql' or '.postgresql_psycopg2' if not db_dict['ENGINE'].startswith('django.db.backends.postgresql'): raise ValueError(f"{db_key} is not a PostgreSQL database. " f"{db_dict['ENGINE']} found for {db_key}'s engine.") # pytest-django will create a new database named 'test_{DATABASES[table_db]['NAME']}' # and use it for our API tests if we don't specify DATABASES[table_db]['TEST']['NAME'] if decouple_config('TEST', default=False, cast=bool): for db_key, _ in decouple_config('MATHESAR_DATABASES', cast=Csv(pipe_delim)):
# Internationalization # https://docs.djangoproject.com/en/1.11/topics/i18n/ LANGUAGE_CODE = config('LANGUAGE_CODE', default='en-us') TIME_ZONE = config('TIME_ZONE', default='UTC') USE_I18N = config('USE_I18N', default=True, cast=bool) USE_L10N = config('USE_L10N', default=True, cast=bool) USE_TZ = config('USE_TZ', default=True, cast=bool) DEBUG = config('DEBUG', default=False, cast=bool) DEV = config('DEV', default=False, cast=bool) EMAIL_BACKEND = config( 'EMAIL_BACKEND', default='django.core.mail.backends.console.EmailBackend') SECRET_KEY = config('SECRET_KEY') SITE_URL = config('SITE_URL', default="http://localhost") ALLOWED_HOSTS = config('ALLOWED_HOSTS', default='localhost', cast=Csv()) # Cache CACHES = { 'default': { 'BACKEND': config('CACHE_BACKEND', default='django.core.cache.backends.memcached.MemcachedCache'), 'LOCATION': config('CACHE_URL', default='127.0.0.1:11211'), } } ################## # Wagtail Settings ##################
import datetime import os from decouple import Csv, config # 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 = config('SECRET_KEY') # SECURITY WARNING: don't run with debug turned on in production! DEBUG = config('DEBUG', default=True, cast=bool) ALLOWED_HOSTS = config('ALLOWED_HOSTS', cast=Csv()) # Application definition INSTALLED_APPS = [ 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', 'corsheaders', 'rest_framework', 'drf_yasg', 'debug_toolbar',
from pathlib import Path import os from decouple import config, Csv # Build paths inside the project like this: BASE_DIR / 'subdir'. BASE_DIR = Path(__file__).resolve(strict=True).parent.parent SECRET_KEY = config('SECRET_KEY') DEBUG = config('DEBUG', True, cast=bool) ALLOWED_HOSTS = config('ALLOWED_HOSTS', default='*', cast=Csv()) INSTALLED_APPS = [ 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', 'main', 'checkout', 'cart', 'corsheaders', ] MIDDLEWARE = [ 'django.middleware.security.SecurityMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.common.CommonMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware',
import os from decouple import config, Csv # 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/3.0/howto/deployment/checklist/ # SECURITY WARNING: keep the secret key used in production secret! SECRET_KEY = config('SECRET_KEY') # SECURITY WARNING: don't run with debug turned on in production! DEBUG = True ALLOWED_HOSTS = config('ALLOWED_HOSTS', cast=Csv()) # CORS allowed origin setting CORS_ORIGIN_ALLOW_ALL = False CORS_ALLOWED_ORIGINS = config('CORS_ALLOWED_ORIGINS', cast=Csv()) # Application definition INSTALLED_APPS = [ 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', 'rest_framework',
'metrics': config('ES_INDEXES_METRICS', 'metrics'), } # Indexes for indexing--set this to ES_INDEXES if you want to read to # and write to the same index. ES_WRITE_INDEXES = ES_INDEXES # This is prepended to index names to get the final read/write index # names used by kitsune. This is so that you can have multiple # environments pointed at the same ElasticSearch cluster and not have # them bump into one another. ES_INDEX_PREFIX = config('ES_INDEX_PREFIX', default='sumo') # Keep indexes up to date as objects are made/deleted. ES_LIVE_INDEXING = config('ES_LIVE_INDEXING', default=True, cast=bool) # Timeout for querying requests ES_TIMEOUT = 5 ES_USE_SSL = config('ES_USE_SSL', default=False, cast=bool) ES_HTTP_AUTH = config('ES_HTTP_AUTH', default='', cast=Csv()) SEARCH_MAX_RESULTS = 1000 SEARCH_RESULTS_PER_PAGE = 10 # Search default settings SEARCH_DEFAULT_CATEGORIES = (10, 20,) SEARCH_DEFAULT_MAX_QUESTION_AGE = 180 * 24 * 60 * 60 # seconds # IA default settings IA_DEFAULT_CATEGORIES = (10, 20,) # The length for which we would like the user to cache search forms # and results, in minutes. SEARCH_CACHE_PERIOD = config('SEARCH_CACHE_PERIOD', default=15, cast=int)
"metrics": config("ES_INDEXES_METRICS", "metrics"), } # Indexes for indexing--set this to ES_INDEXES if you want to read to # and write to the same index. ES_WRITE_INDEXES = ES_INDEXES # This is prepended to index names to get the final read/write index # names used by kitsune. This is so that you can have multiple # environments pointed at the same ElasticSearch cluster and not have # them bump into one another. ES_INDEX_PREFIX = config("ES_INDEX_PREFIX", default="sumo") # Keep indexes up to date as objects are made/deleted. ES_LIVE_INDEXING = config("ES_LIVE_INDEXING", default=True, cast=bool) # Timeout for querying requests ES_TIMEOUT = 5 ES_USE_SSL = config("ES_USE_SSL", default=False, cast=bool) ES_HTTP_AUTH = config("ES_HTTP_AUTH", default="", cast=Csv()) SEARCH_MAX_RESULTS = 1000 SEARCH_RESULTS_PER_PAGE = 10 # Search default settings SEARCH_DEFAULT_CATEGORIES = ( 10, 20, ) SEARCH_DEFAULT_MAX_QUESTION_AGE = 180 * 24 * 60 * 60 # seconds # IA default settings IA_DEFAULT_CATEGORIES = ( 10, 20,