from server.settings.base import * # noqa: WPS347 from server.settings.base import config # GENERAL # ------------------------------------------------------------------------------ # https://docs.djangoproject.com/en/dev/ref/settings/#debug DEBUG = True # https://docs.djangoproject.com/en/dev/ref/settings/#secret-key SECRET_KEY = config('DJANGO_SECRET_KEY') # https://docs.djangoproject.com/en/dev/ref/settings/#allowed-hosts ALLOWED_HOSTS = [ 'localhost', '0.0.0.0', '127.0.0.1', config('DOMAIN_NAME', None) ] # CACHES # ------------------------------------------------------------------------------ # https://docs.djangoproject.com/en/dev/ref/settings/#caches CACHES = { 'default': { 'BACKEND': 'django.core.cache.backends.locmem.LocMemCache', 'LOCATION': '', }, } # EMAIL # ------------------------------------------------------------------------------ # https://docs.djangoproject.com/en/dev/ref/settings/#email-backend EMAIL_BACKEND = config( 'DJANGO_EMAIL_BACKEND', default='django.core.mail.backends.console.EmailBackend',
from server.settings.base import * # noqa: WPS347 from server.settings.base import config # GENERAL # ------------------------------------------------------------------------------ # https://docs.djangoproject.com/en/dev/ref/settings/#secret-key SECRET_KEY = config('DJANGO_SECRET_KEY') # https://docs.djangoproject.com/en/dev/ref/settings/#allowed-hosts ALLOWED_HOSTS = config('DJANGO_ALLOWED_HOSTS', default=['example.com']) # DATABASES # ------------------------------------------------------------------------------ DATABASES = { 'default': { 'ENGINE': 'django.db.backends.postgresql_psycopg2', 'NAME': config('POSTGRES_DB'), 'USER': config('POSTGRES_USER'), 'PASSWORD': config('POSTGRES_PASSWORD'), 'HOST': config('POSTGRES_HOST'), 'PORT': config('POSTGRES_HOST', cast=int), 'CONN_MAX_AGE': config('CONN_MAX_AGE', cast=int, default=60), 'OPTIONS': { 'connect_timeout': 10, }, }, } DATABASES['default']['ATOMIC_REQUESTS'] = True DATABASES['default']['CONN_MAX_AGE'] = config('CONN_MAX_AGE', default=60, cast=int) # CACHES
"""With these settings, tests run faster.""" from server.settings.base import * # noqa: WPS347 from server.settings.base import config # GENERAL # ------------------------------------------------------------------------------ # https://docs.djangoproject.com/en/dev/ref/settings/#secret-key SECRET_KEY = config('DJANGO_SECRET_KEY') # https://docs.djangoproject.com/en/dev/ref/settings/#test-runner TEST_RUNNER = 'django.test.runner.DiscoverRunner' # CACHES # ------------------------------------------------------------------------------ # https://docs.djangoproject.com/en/dev/ref/settings/#caches CACHES = { 'default': { 'BACKEND': 'django.core.cache.backends.locmem.LocMemCache', 'LOCATION': '', }, } # PASSWORDS # ------------------------------------------------------------------------------ # https://docs.djangoproject.com/en/dev/ref/settings/#password-hashers PASSWORD_HASHERS = ['django.contrib.auth.hashers.MD5PasswordHasher'] # TEMPLATES # ------------------------------------------------------------------------------ TEMPLATES[-1]['OPTIONS']['loaders'] = [ # type: ignore[index] # noqa F405 (
from dj_database_url import parse as db_url from server.settings.base import * # noqa: WPS347 from server.settings.base import config # GENERAL # ------------------------------------------------------------------------------ # https://docs.djangoproject.com/en/dev/ref/settings/#secret-key SECRET_KEY = config('DJANGO_SECRET_KEY') # https://docs.djangoproject.com/en/dev/ref/settings/#allowed-hosts ALLOWED_HOSTS = config( 'DJANGO_ALLOWED_HOSTS', cast=lambda line: [host.strip() for host in line.split(',')], ) # DATABASES # ------------------------------------------------------------------------------ DATABASES['default'] = config('DATABASE_URL', cast=db_url) DATABASES['default']['ATOMIC_REQUESTS'] = True DATABASES['default']['CONN_MAX_AGE'] = config('CONN_MAX_AGE', default=60, cast=int) # CACHES # ------------------------------------------------------------------------------ # setup to django-redis if actually needed CACHES = { 'default': { 'BACKEND': 'django.core.cache.backends.locmem.LocMemCache', 'LOCATION': '', },
from server.settings.base import * # noqa: WPS347 from server.settings.base import config # GENERAL # ------------------------------------------------------------------------------ # https://docs.djangoproject.com/en/dev/ref/settings/#debug DEBUG = True # https://docs.djangoproject.com/en/dev/ref/settings/#secret-key SECRET_KEY = config('DJANGO_SECRET_KEY') # https://docs.djangoproject.com/en/dev/ref/settings/#allowed-hosts ALLOWED_HOSTS = ['localhost', '0.0.0.0', '127.0.0.1', config('DOMAIN_NAME', None)] # DATABASES # ------------------------------------------------------------------------------ DATABASES = { 'default': { 'ENGINE': 'django.db.backends.postgresql_psycopg2', 'NAME': config('POSTGRES_DB'), 'USER': config('POSTGRES_USER'), 'PASSWORD': config('POSTGRES_PASSWORD'), 'HOST': config('POSTGRES_HOST'), 'PORT': config('POSTGRES_PORT', cast=int), 'CONN_MAX_AGE': config('CONN_MAX_AGE', cast=int, default=60), 'OPTIONS': { 'connect_timeout': 10, }, }, } DATABASES['default']['ATOMIC_REQUESTS'] = True