This file contains all the settings that defines the development server. SECURITY WARNING: don't run with debug turned on in production! """ import os import socket import logging from typing import List from config.settings.components import env from config.settings.components.common import TEMPLATES, MIDDLEWARE, INSTALLED_APPS DEBUG = True ALLOWED_HOSTS: List[str] = ['*'] SECRET_KEY = env('DJANGO_SECRET_KEY', default='development_secret_key') INSTALLED_APPS += ('django_extensions', ) TEMPLATES[0]['OPTIONS']['debug'] = DEBUG # MAIL SETTINGS # ------------------------------------------------------------------------------ # EMAIL_HOST, EMAIL_PORT = 'mailhog', 1025 # Work with MailHog DEFAULT_FROM_EMAIL = env('DEFAULT_FROM_EMAIL', default='Grow <*****@*****.**>') EMAIL_BACKEND = 'anymail.backends.amazon_ses.EmailBackend' # DEBUGGING # ------------------------------------------------------------------------------ INTERNAL_IPS = ['127.0.0.1', '10.0.2.2'] # localhost IP, docker internal IP # tricks to have debug toolbar when developing with docker
# -*- coding: utf-8 -*- from config.settings.components import env CONSTANCE_CONFIG = { 'REGISTER_REQUIRES_EMAIL_CONFIRMATION': ( True, 'The registering requires email confirmation', ), 'OTP_VALIDATION_URL': ( '', 'It helps to format OTP SMSs', ), } CONSTANCE_BACKEND = 'constance.backends.redisd.RedisBackend' CONSTANCE_REDIS_CONNECTION = env('REDIS_CACHE_URL', default='redis://redis:6379/0')
# -*- coding: utf-8 -*- from config.settings.components import env from config.settings.components.common import TEMPLATES DEBUG = False TEMPLATES[0]['OPTIONS']['debug'] = True # SECRET CONFIGURATION # ------------------------------------------------------------------------------ # See: https://docs.djangoproject.com/en/dev/ref/settings/#secret-key # Note: This key only used for development and testing. SECRET_KEY = env('DJANGO_SECRET_KEY', default='testing_secret_key') ALLOWED_HOSTS = ['*'] # Mail settings # ------------------------------------------------------------------------------ EMAIL_HOST = 'localhost' EMAIL_PORT = 1025 # In-memory email backend stores messages # for unit testing purposes EMAIL_BACKEND = 'django.core.mail.backends.locmem.EmailBackend' # TESTING # ------------------------------------------------------------------------------ TEST_RUNNER = 'django.test.runner.DiscoverRunner' # PASSWORD HASHING # ------------------------------------------------------------------------------
https://docs.djangoproject.com/en/2.2/topics/settings/ For the full list of settings and their config, see https://docs.djangoproject.com/en/2.2/ref/settings/ """ from typing import Dict, List, Tuple, Union from os.path import join from config.settings.components import PROJECT_PATH, env from django.utils.translation import ugettext_lazy as _ # # ADMIN SETTINGS # ------------------------------------------------------------------------------ ADMIN_URL = env('DJANGO_ADMIN_URL', default='admin/') AUTH_USER_MODEL = 'accounts.User' LOGIN_REDIRECT_URL = '/admin/' LOGIN_URL = 'account_login' USERNAME_BLACKLIST = ['vicobits', 'admin'] DJANGO_APPS: Tuple[str, ...] = ( # Default Django apps: 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.sites', 'django.contrib.messages', 'django.contrib.staticfiles', 'django.contrib.redirects', 'django.contrib.postgres',
""" from os.path import join from typing import Dict, List, Tuple, Union from django.utils.translation import ugettext_lazy as _ from config.settings.components import PROJECT_PATH, env ADMINS = (('Support', '*****@*****.**'), ) MANAGERS = ADMINS # # ADMIN SETTINGS # ------------------------------------------------------------------------------ ADMIN_URL = env('DJANGO_ADMIN_URL', default='admin/') #AUTH_USER_MODEL = 'accounts.User' LOGIN_REDIRECT_URL = '/admin/' LOGIN_URL = 'account_login' USERNAME_BLACKLIST = ['admin'] DJANGO_APPS: Tuple[str, ...] = ( # Default Django apps: 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.sites', 'django.contrib.messages', 'django.contrib.staticfiles', 'django.contrib.redirects', 'django.contrib.postgres',
'%Y-%m-%d %H:%M:%SZ', "DEFAULT_PERMISSION_CLASSES": [ "rest_framework_api_key.permissions.HasAPIKey", ] } APPEND_SLASH = True # Simple Django JWT # https://github.com/davesque/django-rest-framework-simplejwt SIMPLE_JWT = { 'ACCESS_TOKEN_LIFETIME': timedelta(days=7), 'REFRESH_TOKEN_LIFETIME': timedelta(days=1), 'ROTATE_REFRESH_TOKENS': False, 'BLACKLIST_AFTER_ROTATION': True, 'ALGORITHM': 'HS256', 'SIGNING_KEY': env('DJANGO_SECRET_KEY', default='default_secret_key'), 'VERIFYING_KEY': None, 'AUDIENCE': None, 'ISSUER': None, 'AUTH_HEADER_TYPES': ('Bearer', ), 'USER_ID_FIELD': 'id', 'USER_ID_CLAIM': 'user_id', 'AUTH_TOKEN_CLASSES': ('rest_framework_simplejwt.tokens.AccessToken', ), 'TOKEN_TYPE_CLAIM': 'token_type', 'JTI_CLAIM': 'jti', 'SLIDING_TOKEN_REFRESH_EXP_CLAIM': 'refresh_exp', 'SLIDING_TOKEN_LIFETIME': timedelta(minutes=5), 'SLIDING_TOKEN_REFRESH_LIFETIME': timedelta(days=1), }
"""Production settings. This file contains all the settings used in production. This file is required and if development.py is present these values are overridden. https://docs.djangoproject.com/en/2.2/howto/deployment/ """ from config.settings.components import env from config.settings.components.common import TEMPLATES, INSTALLED_APPS DEBUG = False ALLOWED_HOSTS = env.list('DJANGO_ALLOWED_HOSTS') SECRET_KEY = env('DJANGO_SECRET_KEY') # # TEMPLATE CONFIGURATION # ------------------------------------------------------------------------------ # See: # https://docs.djangoproject.com/en/dev/ref/templates/api/#django.template.loaders.cached.Loader TEMPLATES[0]['OPTIONS']['loaders'] = [ # noqa: F405 ( 'django.template.loaders.cached.Loader', [ 'django.template.loaders.filesystem.Loader', 'django.template.loaders.app_directories.Loader', ], ), ]
# -*- coding: utf-8 -*- # Caching # https://docs.djangoproject.com/en/2.2/topics/cache/ from config.settings.components import env REDIS_CACHE_URL = env('REDIS_CACHE_URL', default='redis://redis:6379/0') # CACHE CONFIGURATION # ------------------------------------------------------------------------------ CACHES = { 'default': { 'BACKEND': 'django.core.cache.backends.locmem.LocMemCache' } }
from typing import Dict, List, Tuple, Union from os.path import join from config.settings.components import PROJECT_PATH, env from django.utils.translation import ugettext_lazy as _ ADMINS = ( ('Support', '*****@*****.**'), ) MANAGERS = ADMINS # # ADMIN SETTINGS # ------------------------------------------------------------------------------ ADMIN_URL = env('DJANGO_ADMIN_URL', default='admin/') #AUTH_USER_MODEL = 'accounts.User' LOGIN_REDIRECT_URL = '/admin/' LOGIN_URL = 'account_login' USERNAME_BLACKLIST = ['admin'] DJANGO_APPS: Tuple[str, ...] = ( # Default Django apps: 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.sites', 'django.contrib.messages', 'django.contrib.staticfiles', 'django.contrib.redirects',
# -*- encoding: utf-8 -*- from config.settings.components import env GOOGLE_CLIENT_ID = env('GOOGLE_CLIENT_ID') FACEBOOK_CLIENT_ID = env('FACEBOOK_CLIENT_ID') FACEBOOK_CLIENT_SECRET = env('FACEBOOK_CLIENT_SECRET') TWILIO_ACCOUNT_SID = env('TWILIO_ACCOUNT_SID') TWILIO_AUTH_TOKEN = env('TWILIO_AUTH_TOKEN') TWILIO_PHONE_NUMBER = env('TWILIO_PHONE_NUMBER')
# -*- coding: utf-8 -*- """Production settings. This file contains all the settings used in production. This file is required and if development.py is present these values are overridden. https://docs.djangoproject.com/en/2.2/howto/deployment/ """ from config.settings.components import env from config.settings.components.common import TEMPLATES, INSTALLED_APPS DEBUG = False ALLOWED_HOSTS = env.list('DJANGO_ALLOWED_HOSTS') SECRET_KEY = env('DJANGO_SECRET_KEY') # # TEMPLATE CONFIGURATION # ------------------------------------------------------------------------------ # See: # https://docs.djangoproject.com/en/dev/ref/templates/api/#django.template.loaders.cached.Loader TEMPLATES[0]['OPTIONS']['loaders'] = [ # noqa: F405 ( 'django.template.loaders.cached.Loader', [ 'django.template.loaders.filesystem.Loader', 'django.template.loaders.app_directories.Loader', ], ), ]
# -*- coding: utf-8 -*- # Celery # http://docs.celeryproject.org/en/latest/userguide/configuration.html#std:setting-broker_url from config.settings.components import env CELERY_BROKER_URL = env('CELERY_BROKER_URL', default='redis://redis:6379/1') # http://docs.celeryproject.org/en/latest/userguide/configuration.html#std:setting-result_backend CELERY_RESULT_BACKEND = 'django-db' CELERY_CACHE_BACKEND = 'django-cache' CELERY_TIMEZONE = 'UTC' # http://docs.celeryproject.org/en/latest/userguide/configuration.html#std:setting-accept_content CELERY_ACCEPT_CONTENT = ['json'] # http://docs.celeryproject.org/en/latest/userguide/configuration.html#std:setting-task_serializer CELERY_TASK_SERIALIZER = 'json' # http://docs.celeryproject.org/en/latest/userguide/configuration.html#std:setting-result_serializer CELERY_RESULT_SERIALIZER = 'json' # http://docs.celeryproject.org/en/latest/userguide/configuration.html#task-time-limit # TODO: set to whatever value is adequate in your circumstances CELERY_TASK_TIME_LIMIT = 5 * 60 # http://docs.celeryproject.org/en/latest/userguide/configuration.html#task-soft-time-limit # TODO: set to whatever value is adequate in your circumstances CELERY_TASK_SOFT_TIME_LIMIT = 60 # http://docs.celeryproject.org/en/latest/userguide/configuration.html#beat-scheduler CELERY_BEAT_SCHEDULER = 'django_celery_beat.schedulers:DatabaseScheduler'
This file contains all the settings that defines the development server. SECURITY WARNING: don't run with debug turned on in production! """ import os import socket import logging from typing import List from config.settings.components import env from config.settings.components.common import TEMPLATES, MIDDLEWARE, INSTALLED_APPS DEBUG = True ALLOWED_HOSTS: List[str] = ['*'] SECRET_KEY = env('DJANGO_SECRET_KEY', default='development_secret_key') INSTALLED_APPS += ( 'debug_toolbar', 'django_extensions', 'django_migration_linter', ) TEMPLATES[0]['OPTIONS']['debug'] = DEBUG # Django debug toolbar: # https://django-debug-toolbar.readthedocs.io MIDDLEWARE += ( 'debug_toolbar.middleware.DebugToolbarMiddleware', # https://github.com/bradmontgomery/django-querycount # Prints how many queries were executed, useful for the APIs.
# -*- coding: utf-8 -*- # Database # https://docs.djangoproject.com/en/2.2/ref/settings/#databases from config.settings.components import env DATABASES = { 'default': { 'ENGINE': 'django.db.backends.postgresql', 'NAME': env('POSTGRES_DB', default='postgres'), 'USER': env('POSTGRES_USER', default='postgres'), 'PASSWORD': env('POSTGRES_PASSWORD', default='postgres'), 'HOST': env('POSTGRES_HOST', default='postgres'), 'PORT': env('POSTGRES_PORT', default='5432'), 'CONN_MAX_AGE': env('POSTGRES_CONN_MAX_AGE', default=60), 'ATOMIC_REQUESTS': True, 'OPTIONS': { 'connect_timeout': 10, }, }, }
# -*- coding: utf-8 -*- """Django development settings. This file contains all the settings that defines the development server. SECURITY WARNING: don't run with debug turned on in production! """ import os import socket from typing import List from config.settings.components import env from config.settings.components.common import INSTALLED_APPS, TEMPLATES DEBUG = True ALLOWED_HOSTS: List[str] = ['*'] SECRET_KEY = env('DJANGO_SECRET_KEY', default='development_secret_key') INSTALLED_APPS += ('django_extensions', ) TEMPLATES[0]['OPTIONS']['debug'] = DEBUG # DEBUGGING # ------------------------------------------------------------------------------ INTERNAL_IPS = ['127.0.0.1', '10.0.2.2'] # localhost IP, docker internal IP # TESTING # ------------------------------------------------------------------------------ TEST_RUNNER = 'django.test.runner.DiscoverRunner'
# -*- encoding: utf-8 -*- from config.settings.components import env GOOGLE_CLIENT_ID = env('GOOGLE_CLIENT_ID') DJANGO_ADMIN_SSO_OAUTH_CLIENT_ID = env('ADMIN_GOOGLE_OAUTH_CLIENT_ID') DJANGO_ADMIN_SSO_OAUTH_CLIENT_SECRET = env('ADMIN_GOOGLE_OAUTH_CLIENT_SECRET') FACEBOOK_CLIENT_ID = env('FACEBOOK_CLIENT_ID') FACEBOOK_CLIENT_SECRET = env('FACEBOOK_CLIENT_SECRET')