|
12 | 12 |
|
13 | 13 | import os
|
14 | 14 |
|
15 |
| -from config.env import env, BASE_DIR |
| 15 | +from config.env import BASE_DIR, env |
16 | 16 |
|
17 | 17 | env.read_env(os.path.join(BASE_DIR, ".env"))
|
18 | 18 |
|
19 | 19 | # Quick-start development settings - unsuitable for production
|
20 | 20 | # See https://docs.djangoproject.com/en/3.0/howto/deployment/checklist/
|
21 | 21 |
|
22 | 22 | # SECURITY WARNING: keep the secret key used in production secret!
|
23 |
| -SECRET_KEY = '=ug_ucl@yi6^mrcjyz%(u0%&g2adt#bz3@yos%#@*t#t!ypx=a' |
| 23 | +SECRET_KEY = "=ug_ucl@yi6^mrcjyz%(u0%&g2adt#bz3@yos%#@*t#t!ypx=a" |
24 | 24 |
|
25 | 25 | # SECURITY WARNING: don't run with debug turned on in production!
|
26 | 26 | DEBUG = True
|
27 | 27 |
|
28 |
| -ALLOWED_HOSTS = ['*'] |
| 28 | +ALLOWED_HOSTS = ["*"] |
29 | 29 |
|
30 | 30 |
|
31 | 31 | # Application definition
|
32 | 32 |
|
33 | 33 | LOCAL_APPS = [
|
34 |
| - 'styleguide_example.core.apps.CoreConfig', |
35 |
| - 'styleguide_example.common.apps.CommonConfig', |
36 |
| - 'styleguide_example.tasks.apps.TasksConfig', |
37 |
| - 'styleguide_example.api.apps.ApiConfig', |
38 |
| - 'styleguide_example.users.apps.UsersConfig', |
39 |
| - 'styleguide_example.errors.apps.ErrorsConfig', |
40 |
| - 'styleguide_example.testing_examples.apps.TestingExamplesConfig', |
41 |
| - 'styleguide_example.integrations.apps.IntegrationsConfig', |
42 |
| - 'styleguide_example.files.apps.FilesConfig', |
43 |
| - 'styleguide_example.emails.apps.EmailsConfig', |
| 34 | + "styleguide_example.core.apps.CoreConfig", |
| 35 | + "styleguide_example.common.apps.CommonConfig", |
| 36 | + "styleguide_example.tasks.apps.TasksConfig", |
| 37 | + "styleguide_example.api.apps.ApiConfig", |
| 38 | + "styleguide_example.users.apps.UsersConfig", |
| 39 | + "styleguide_example.errors.apps.ErrorsConfig", |
| 40 | + "styleguide_example.testing_examples.apps.TestingExamplesConfig", |
| 41 | + "styleguide_example.integrations.apps.IntegrationsConfig", |
| 42 | + "styleguide_example.files.apps.FilesConfig", |
| 43 | + "styleguide_example.emails.apps.EmailsConfig", |
44 | 44 | ]
|
45 | 45 |
|
46 | 46 | THIRD_PARTY_APPS = [
|
47 |
| - 'rest_framework', |
48 |
| - 'django_celery_results', |
49 |
| - 'django_celery_beat', |
50 |
| - 'django_filters', |
51 |
| - 'corsheaders', |
52 |
| - 'django_extensions', |
53 |
| - 'rest_framework_jwt', |
| 47 | + "rest_framework", |
| 48 | + "django_celery_results", |
| 49 | + "django_celery_beat", |
| 50 | + "django_filters", |
| 51 | + "corsheaders", |
| 52 | + "django_extensions", |
| 53 | + "rest_framework_jwt", |
54 | 54 | ]
|
55 | 55 |
|
56 | 56 | INSTALLED_APPS = [
|
57 |
| - 'django.contrib.admin', |
58 |
| - 'django.contrib.auth', |
59 |
| - 'django.contrib.contenttypes', |
60 |
| - 'django.contrib.sessions', |
61 |
| - 'django.contrib.messages', |
| 57 | + "django.contrib.admin", |
| 58 | + "django.contrib.auth", |
| 59 | + "django.contrib.contenttypes", |
| 60 | + "django.contrib.sessions", |
| 61 | + "django.contrib.messages", |
62 | 62 | # http://whitenoise.evans.io/en/stable/django.html#using-whitenoise-in-development
|
63 |
| - 'whitenoise.runserver_nostatic', |
64 |
| - 'django.contrib.staticfiles', |
| 63 | + "whitenoise.runserver_nostatic", |
| 64 | + "django.contrib.staticfiles", |
65 | 65 | *THIRD_PARTY_APPS,
|
66 | 66 | *LOCAL_APPS,
|
67 | 67 | ]
|
68 | 68 |
|
69 | 69 | MIDDLEWARE = [
|
70 |
| - 'django.middleware.security.SecurityMiddleware', |
71 |
| - 'corsheaders.middleware.CorsMiddleware', |
72 |
| - 'whitenoise.middleware.WhiteNoiseMiddleware', |
73 |
| - 'django.contrib.sessions.middleware.SessionMiddleware', |
74 |
| - 'django.middleware.common.CommonMiddleware', |
75 |
| - 'django.middleware.csrf.CsrfViewMiddleware', |
76 |
| - 'django.contrib.auth.middleware.AuthenticationMiddleware', |
77 |
| - 'django.contrib.messages.middleware.MessageMiddleware', |
78 |
| - 'django.middleware.clickjacking.XFrameOptionsMiddleware', |
| 70 | + "django.middleware.security.SecurityMiddleware", |
| 71 | + "corsheaders.middleware.CorsMiddleware", |
| 72 | + "whitenoise.middleware.WhiteNoiseMiddleware", |
| 73 | + "django.contrib.sessions.middleware.SessionMiddleware", |
| 74 | + "django.middleware.common.CommonMiddleware", |
| 75 | + "django.middleware.csrf.CsrfViewMiddleware", |
| 76 | + "django.contrib.auth.middleware.AuthenticationMiddleware", |
| 77 | + "django.contrib.messages.middleware.MessageMiddleware", |
| 78 | + "django.middleware.clickjacking.XFrameOptionsMiddleware", |
79 | 79 | ]
|
80 | 80 |
|
81 |
| -ROOT_URLCONF = 'config.urls' |
| 81 | +ROOT_URLCONF = "config.urls" |
82 | 82 |
|
83 | 83 | TEMPLATES = [
|
84 | 84 | {
|
85 |
| - 'BACKEND': 'django.template.backends.django.DjangoTemplates', |
86 |
| - 'DIRS': [], |
87 |
| - 'APP_DIRS': True, |
88 |
| - 'OPTIONS': { |
89 |
| - 'context_processors': [ |
90 |
| - 'django.template.context_processors.debug', |
91 |
| - 'django.template.context_processors.request', |
92 |
| - 'django.contrib.auth.context_processors.auth', |
93 |
| - 'django.contrib.messages.context_processors.messages', |
| 85 | + "BACKEND": "django.template.backends.django.DjangoTemplates", |
| 86 | + "DIRS": [], |
| 87 | + "APP_DIRS": True, |
| 88 | + "OPTIONS": { |
| 89 | + "context_processors": [ |
| 90 | + "django.template.context_processors.debug", |
| 91 | + "django.template.context_processors.request", |
| 92 | + "django.contrib.auth.context_processors.auth", |
| 93 | + "django.contrib.messages.context_processors.messages", |
94 | 94 | ],
|
95 | 95 | },
|
96 | 96 | },
|
97 | 97 | ]
|
98 | 98 |
|
99 |
| -WSGI_APPLICATION = 'config.wsgi.application' |
| 99 | +WSGI_APPLICATION = "config.wsgi.application" |
100 | 100 |
|
101 | 101 |
|
102 | 102 | # Database
|
103 | 103 | # https://docs.djangoproject.com/en/3.0/ref/settings/#databases
|
104 | 104 |
|
105 | 105 | DATABASES = {
|
106 |
| - 'default': env.db('DATABASE_URL', default='postgres:///styleguide_example'), |
| 106 | + "default": env.db("DATABASE_URL", default="postgres:///styleguide_example"), |
107 | 107 | }
|
108 |
| -DATABASES['default']['ATOMIC_REQUESTS'] = True |
| 108 | +DATABASES["default"]["ATOMIC_REQUESTS"] = True |
109 | 109 |
|
110 |
| -if os.environ.get('GITHUB_WORKFLOW'): |
| 110 | +if os.environ.get("GITHUB_WORKFLOW"): |
111 | 111 | DATABASES = {
|
112 |
| - 'default': { |
113 |
| - 'ENGINE': 'django.db.backends.postgresql', |
114 |
| - 'NAME': 'github_actions', |
115 |
| - 'USER': 'postgres', |
116 |
| - 'PASSWORD': 'postgres', |
117 |
| - 'HOST': '127.0.0.1', |
118 |
| - 'PORT': '5432', |
| 112 | + "default": { |
| 113 | + "ENGINE": "django.db.backends.postgresql", |
| 114 | + "NAME": "github_actions", |
| 115 | + "USER": "postgres", |
| 116 | + "PASSWORD": "postgres", |
| 117 | + "HOST": "127.0.0.1", |
| 118 | + "PORT": "5432", |
119 | 119 | }
|
120 | 120 | }
|
121 | 121 |
|
|
125 | 125 |
|
126 | 126 | AUTH_PASSWORD_VALIDATORS = [
|
127 | 127 | {
|
128 |
| - 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator', |
| 128 | + "NAME": "django.contrib.auth.password_validation.UserAttributeSimilarityValidator", |
129 | 129 | },
|
130 | 130 | {
|
131 |
| - 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator', |
| 131 | + "NAME": "django.contrib.auth.password_validation.MinimumLengthValidator", |
132 | 132 | },
|
133 | 133 | {
|
134 |
| - 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator', |
| 134 | + "NAME": "django.contrib.auth.password_validation.CommonPasswordValidator", |
135 | 135 | },
|
136 | 136 | {
|
137 |
| - 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator', |
| 137 | + "NAME": "django.contrib.auth.password_validation.NumericPasswordValidator", |
138 | 138 | },
|
139 | 139 | ]
|
140 | 140 |
|
141 |
| -AUTH_USER_MODEL = 'users.BaseUser' |
| 141 | +AUTH_USER_MODEL = "users.BaseUser" |
142 | 142 |
|
143 | 143 |
|
144 | 144 | # Internationalization
|
145 | 145 | # https://docs.djangoproject.com/en/3.0/topics/i18n/
|
146 | 146 |
|
147 |
| -LANGUAGE_CODE = 'en-us' |
| 147 | +LANGUAGE_CODE = "en-us" |
148 | 148 |
|
149 |
| -TIME_ZONE = 'UTC' |
| 149 | +TIME_ZONE = "UTC" |
150 | 150 |
|
151 | 151 | USE_I18N = True
|
152 | 152 |
|
|
158 | 158 | # Static files (CSS, JavaScript, Images)
|
159 | 159 | # https://docs.djangoproject.com/en/3.0/howto/static-files/
|
160 | 160 |
|
161 |
| -STATIC_ROOT = os.path.join(BASE_DIR, 'staticfiles') |
162 |
| -STATIC_URL = '/static/' |
163 |
| -STATICFILES_STORAGE = 'whitenoise.storage.CompressedManifestStaticFilesStorage' |
| 161 | +STATIC_ROOT = os.path.join(BASE_DIR, "staticfiles") |
| 162 | +STATIC_URL = "/static/" |
| 163 | +STATICFILES_STORAGE = "whitenoise.storage.CompressedManifestStaticFilesStorage" |
164 | 164 |
|
165 | 165 | REST_FRAMEWORK = {
|
166 |
| - 'EXCEPTION_HANDLER': 'styleguide_example.api.exception_handlers.drf_default_with_modifications_exception_handler', |
| 166 | + "EXCEPTION_HANDLER": "styleguide_example.api.exception_handlers.drf_default_with_modifications_exception_handler", |
167 | 167 | # 'EXCEPTION_HANDLER': 'styleguide_example.api.exception_handlers.hacksoft_proposed_exception_handler',
|
168 |
| - 'DEFAULT_FILTER_BACKENDS': ( |
169 |
| - 'django_filters.rest_framework.DjangoFilterBackend', |
170 |
| - ), |
171 |
| - 'DEFAULT_AUTHENTICATION_CLASSES': [] |
| 168 | + "DEFAULT_FILTER_BACKENDS": ("django_filters.rest_framework.DjangoFilterBackend",), |
| 169 | + "DEFAULT_AUTHENTICATION_CLASSES": [], |
172 | 170 | }
|
173 | 171 |
|
174 | 172 | APP_DOMAIN = env("APP_DOMAIN", default="http://localhost:8000")
|
175 | 173 |
|
176 | 174 | DEFAULT_AUTO_FIELD = "django.db.models.BigAutoField"
|
177 | 175 |
|
| 176 | +from config.settings.celery import * # noqa |
178 | 177 | from config.settings.cors import * # noqa
|
| 178 | +from config.settings.email_sending import * # noqa |
| 179 | +from config.settings.files_and_storages import * # noqa |
179 | 180 | from config.settings.jwt import * # noqa
|
180 |
| -from config.settings.sessions import * # noqa |
181 |
| -from config.settings.celery import * # noqa |
182 | 181 | from config.settings.sentry import * # noqa
|
183 |
| - |
184 |
| -from config.settings.files_and_storages import * # noqa |
185 |
| -from config.settings.email_sending import * # noqa |
| 182 | +from config.settings.sessions import * # noqa |
0 commit comments