'https://*.gravatar.com', 'https://*.mapbox.com', 'https://*.satnogs.org', 'https://*.google-analytics.com', 'data:', 'blob:', ) CSP_STYLE_SRC = ( "'self'", "'unsafe-inline'", ) CSP_CHILD_SRC = ('blob:', ) # Database DATABASE_URL = config('DATABASE_URL', default='sqlite:///db.sqlite3') DATABASES = {'default': db_url(DATABASE_URL)} DATABASES_EXTRAS = { 'OPTIONS': { 'init_command': 'SET sql_mode="STRICT_TRANS_TABLES"' }, } if DATABASES['default']['ENGINE'].split('.')[-1] == 'mysql': DATABASES['default'].update(DATABASES_EXTRAS) # Mapbox API MAPBOX_GEOCODE_URL = 'https://api.tiles.mapbox.com/v4/geocode/mapbox.places/' MAPBOX_MAP_ID = config('MAPBOX_MAP_ID', default='') MAPBOX_TOKEN = config('MAPBOX_TOKEN', default='') # Metrics OPBEAT = {
'django.template.context_processors.request', 'django.contrib.auth.context_processors.auth', 'django.contrib.messages.context_processors.messages', ], }, }, ] WSGI_APPLICATION = 'lotr.wsgi.application' # Database # https://docs.djangoproject.com/en/1.9/ref/settings/#databases DATABASES = { 'default': db_url(config('DATABASE_URL')) } # Password validation # https://docs.djangoproject.com/en/1.9/ref/settings/#auth-password-validators AUTH_PASSWORD_VALIDATORS = [ { 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator', }, { 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator', }, { 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
'django.contrib.auth.context_processors.auth', 'django.contrib.messages.context_processors.messages', ], }, }, ] WSGI_APPLICATION = 'blitz_api.wsgi.application' # Database # https://docs.djangoproject.com/en/2.0/ref/settings/#databases # Force sqlite3 during unittests. Temporary. if len(sys.argv) > 1 and sys.argv[1] == 'test': DATABASES = { 'default': db_url('sqlite:///' + str(BASE_DIR.joinpath('db.sqlite3'))), } else: DATABASES = { 'default': config( 'DATABASE_URL', default='sqlite:///' + str(BASE_DIR.joinpath('db.sqlite3')), cast=db_url ) } # Custom user model AUTH_USER_MODEL = 'blitz_api.User' # Password validation
'social_core.pipeline.social_auth.associate_user', 'social_core.pipeline.social_auth.load_extra_data', 'social_core.pipeline.user.user_details', ) ROOT_URLCONF = 'pets.urls' WSGI_APPLICATION = 'pets.wsgi.application' # Database # https://docs.djangoproject.com/en/dev/ref/settings/#databases conn_max_age = config('DB_CONN_MAX_AGE', default=0, cast=int) default_db_url = config('DATABASE_URL') DATABASES = { 'default': db_url(default_db_url, conn_max_age=conn_max_age) } # Internationalization # https://docs.djangoproject.com/en/dev/topics/i18n/ LANGUAGE_CODE = 'pt-BR' TIME_ZONE = 'America/Sao_Paulo' USE_I18N = True USE_L10N = True USE_TZ = True
] WSGI_APPLICATION = 'server.wsgi.application' # Database # https://docs.djangoproject.com/en/3.1/ref/settings/#databases DATABASES = { 'default': { 'ENGINE': 'django.db.backends.sqlite3', 'NAME': BASE_DIR / 'db.sqlite3', } } DATABASES['default'] = db_url(config('DATABASES')) # Password validation # https://docs.djangoproject.com/en/3.1/ref/settings/#auth-password-validators AUTH_PASSWORD_VALIDATORS = [ {'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator', }, {'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator', }, {'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator', }, {'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator', }, ] # Internationalization # https://docs.djangoproject.com/en/3.1/topics/i18n/
'OPTIONS': { '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 = 'sfd.wsgi.application' # Database DATABASES = {'default': db_url(config('DATABASE_URL'))} # Internationalization LANGUAGE_CODE = 'pt-br' TIME_ZONE = 'America/Fortaleza' USE_I18N = True USE_L10N = True USE_TZ = True # Static files (CSS, JavaScript, Images)
'users.pipeline.add_facebook_link', 'social_core.pipeline.social_auth.associate_user', 'social_core.pipeline.social_auth.load_extra_data', 'social_core.pipeline.user.user_details', ) ROOT_URLCONF = 'pets.urls' WSGI_APPLICATION = 'pets.wsgi.application' # Database # https://docs.djangoproject.com/en/dev/ref/settings/#databases conn_max_age = config('DB_CONN_MAX_AGE', default=0, cast=int) default_db_url = config('DATABASE_URL') DATABASES = {'default': db_url(default_db_url, conn_max_age=conn_max_age)} # Internationalization # https://docs.djangoproject.com/en/dev/topics/i18n/ LANGUAGE_CODE = 'pt-BR' TIME_ZONE = 'America/Sao_Paulo' USE_I18N = True USE_L10N = True USE_TZ = True # Static files (CSS, JavaScript, Images)
"users.pipeline.add_facebook_link", "social_core.pipeline.social_auth.associate_user", "social_core.pipeline.social_auth.load_extra_data", "social_core.pipeline.user.user_details", ) ROOT_URLCONF = "pets.urls" WSGI_APPLICATION = "pets.wsgi.application" # Database # https://docs.djangoproject.com/en/dev/ref/settings/#databases conn_max_age = config("DB_CONN_MAX_AGE", default=0, cast=int) default_db_url = config("DATABASE_URL") DATABASES = {"default": db_url(default_db_url, conn_max_age=conn_max_age)} # Internationalization # https://docs.djangoproject.com/en/dev/topics/i18n/ LANGUAGE_CODE = "pt-BR" TIME_ZONE = "America/Sao_Paulo" USE_I18N = True USE_L10N = True USE_TZ = True # Static files (CSS, JavaScript, Images)
from .settings import * # flake8: noqa config = Config(RepositoryEnv(BASE_DIR.child('legacy', '.env'))) INSTALLED_APPS += ( 'sapl.legacy', # legacy reversed model definitions ) DATABASES['legacy'] = config( 'DATABASE_URL_FONTE', cast=db_url, ) DATABASES['default'] = config('DATABASE_URL_DESTINO', cast=lambda v: v if isinstance(v, dict) else db_url(v), default=DATABASES['default']) # Sobrescreve o nome dos bancos caso a variável de ambiente seja definida # Útil para migração em lote de vários bancos DATABASE_NAME_OVERRIDE = os.environ.get('DATABASE_NAME') if DATABASE_NAME_OVERRIDE: DATABASES['legacy']['NAME'] = DATABASE_NAME_OVERRIDE # não altera o nome se o destino é um banco em memória if not DATABASES['default']['NAME'] == ':memory:': DATABASES['default']['NAME'] = DATABASE_NAME_OVERRIDE DATABASE_ROUTERS = [ 'sapl.legacy.router.LegacyRouter', ]
# Django settings for pyment project. from decouple import config, Csv from unipath import Path from dj_database_url import parse as db_url from dj_email_url import parse as email_url BASE_DIR = Path(__file__).parent.parent PUBLIC_ROOT = Path(config("PUBLIC_ROOT", default="")) DEBUG = config("DEBUG", default=False, cast=bool) TRAVIS = config("TRAVIS", default=False, cast=bool) DATABASES = {"default": db_url(config("DATABASE_URL"), ssl_require=True)} SITE_NAME = config("SITE_NAME", default="Site Name") META_KEYWORDS = config("META_KEYWORDS", default="meta") META_DESCRIPTION = config("META_DESCRIPTION", default="meta description") BREWER_NAME = config("BREWER_NAME", default="Joe Brewer") BREWER_EMAIL = config("BREWER_EMAIL", default="*****@*****.**") BREWER_LOCATION = config("BREWER_LOCATION", default="Anywhere, USA") ADMINS = ( # ('Your Name', '*****@*****.**'), (BREWER_NAME, BREWER_EMAIL), ) MANAGERS = ADMINS
"'self'", 'https://*.gravatar.com', 'https://*.mapbox.com', 'https://*.google-analytics.com', ) SECURE_HSTS_SECONDS = getenv('SECURE_HSTS_SECONDS', 31536000) SECURE_HSTS_INCLUDE_SUBDOMAINS = True SECURE_CONTENT_TYPE_NOSNIFF = True SECURE_BROWSER_XSS_FILTER = True ALLOWED_HOSTS = [ getenv('ALLOWED_HOSTS', '*') ] # Database DATABASE_URL = getenv('DATABASE_URL', 'sqlite:///db.sqlite3') DATABASES = {'default': db_url(DATABASE_URL)} # NETWORK API NETWORK_API_ENDPOINT = getenv('NETWORK_API_ENDPOINT', 'https://network.satnogs.org/api/') DATA_FETCH_DAYS = getenv('DATA_FETCH_DAYS', 10) SATELLITE_POSITION_ENDPOINT = getenv('SATELLITE_POSITION_ENDPOINT', 'https://network.satnogs.org/satellite_position/') # Mapbox API MAPBOX_GEOCODE_URL = 'https://api.tiles.mapbox.com/v4/geocode/mapbox.places/' MAPBOX_MAP_ID = getenv('MAPBOX_MAP_ID', '') MAPBOX_TOKEN = getenv('MAPBOX_TOKEN', '') # Metrics OPBEAT = { 'ORGANIZATION_ID': getenv('OPBEAT_ORGID', None),
'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 = 'main.wsgi.application' # Database # https://docs.djangoproject.com/en/3.1/ref/settings/#databases DATABASE_URL = config('DATABASE_URL') DATABASES = {'default': db_url(DATABASE_URL, conn_max_age=300)} # Password validation # https://docs.djangoproject.com/en/3.1/ref/settings/#auth-password-validators AUTH_PASSWORD_VALIDATORS = [ { 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator', }, { 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator', }, { 'NAME':
], }, }, ] 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):
from decouple import Config, RepositoryEnv from dj_database_url import parse as db_url from .settings import * # flake8: noqa config = Config(RepositoryEnv(BASE_DIR.child('legacy', '.env'))) INSTALLED_APPS += ( 'sapl.legacy', # legacy reversed model definitions ) DATABASES['legacy'] = config('DATABASE_URL_FONTE', cast=db_url,) DATABASES['default'] = config( 'DATABASE_URL_DESTINO', cast=lambda v: v if isinstance(v, dict) else db_url(v), default=DATABASES['default']) # Sobrescreve o nome dos bancos caso a variável de ambiente seja definida # Útil para migração em lote de vários bancos DATABASE_NAME_OVERRIDE = os.environ.get('DATABASE_NAME') if DATABASE_NAME_OVERRIDE: DATABASES['legacy']['NAME'] = DATABASE_NAME_OVERRIDE # não altera o nome se o destino é um banco em memória if not DATABASES['default']['NAME'] == ':memory:': DATABASES['default']['NAME'] = DATABASE_NAME_OVERRIDE DATABASE_ROUTERS = ['sapl.legacy.router.LegacyRouter', ] DEBUG = True
DATABASES = { 'default': { 'ENGINE': 'django.db.backends.mysql', 'NAME': config('DB_NAME', None), 'USER': config('DB_USER', None), 'PASSWORD': config('DB_PASSWORD', None), 'HOST': config('DB_HOST', None), 'PORT': config('DB_PORT', None), }, } DB_URL = config('DB_URL', None) if DB_URL is not None: DATABASES['default'] = db_url(DB_URL) LANGUAGE_CODE = 'en-us' TIME_ZONE = 'UTC' USE_I18N = True USE_L10N = True USE_TZ = True STATIC_URL = '/static/' STATIC_ROOT = os.path.abspath(os.path.join(BASE_DIR, '..', 'staticfiles'))