|
10 | 10 | https://docs.djangoproject.com/en/4.2/ref/settings/
|
11 | 11 | """
|
12 | 12 | import os
|
13 |
| -import sentry_sdk |
14 | 13 | from pathlib import Path
|
15 | 14 | from typing import Any
|
16 | 15 |
|
| 16 | +import sentry_sdk |
17 | 17 | # Sentry init and config:
|
18 | 18 | # - If you want to use Sentry, specify the DSN via the env var of `SENTRY_DSN`.
|
19 | 19 | # - Useful defaults for a development environment are set below. They can be
|
|
81 | 81 | 'debug_toolbar',
|
82 | 82 | 'django_extensions',
|
83 | 83 | 'models_extensions',
|
| 84 | + 'rest_framework', |
| 85 | + 'drf_spectacular', |
84 | 86 | 'django_filters',
|
85 | 87 | 'health_check',
|
86 | 88 | 'health_check.db',
|
|
150 | 152 | }
|
151 | 153 | }
|
152 | 154 |
|
| 155 | + |
| 156 | +PAGE_SIZE = os.environ.get('PAGE_SIZE', 10) |
| 157 | + |
| 158 | + |
| 159 | +# Django REST framework |
| 160 | +# https://www.django-rest-framework.org/ |
| 161 | +REST_FRAMEWORK = { |
| 162 | + "DEFAULT_PAGINATION_CLASS": "rest_framework.pagination.LimitOffsetPagination", |
| 163 | + "PAGE_SIZE": os.environ.get('PAGE_SIZE', PAGE_SIZE), |
| 164 | + 'DEFAULT_RENDERER_CLASSES': [ |
| 165 | + 'rest_framework.renderers.JSONRenderer', |
| 166 | + 'rest_framework.renderers.BrowsableAPIRenderer', |
| 167 | + ], |
| 168 | + 'DEFAULT_PARSER_CLASSES': [ |
| 169 | + 'rest_framework.parsers.JSONParser', |
| 170 | + 'rest_framework.parsers.MultiPartParser', |
| 171 | + ], |
| 172 | + 'DEFAULT_AUTHENTICATION_CLASSES': [ |
| 173 | + 'rest_framework.authentication.BasicAuthentication', |
| 174 | + 'rest_framework.authentication.SessionAuthentication', |
| 175 | + ], |
| 176 | + 'DEFAULT_SCHEMA_CLASS': 'drf_spectacular.openapi.AutoSchema', |
| 177 | + 'DEFAULT_FILTER_BACKENDS': ( |
| 178 | + 'django_filters.rest_framework.DjangoFilterBackend', |
| 179 | + ), |
| 180 | + |
| 181 | +} |
| 182 | + |
| 183 | + |
| 184 | +# DRF Spectacular settings |
| 185 | +# https://drf-spectacular.readthedocs.io/en/latest/settings.html |
| 186 | +SPECTACULAR_SETTINGS = { |
| 187 | + 'TITLE': 'Signal Documentation', |
| 188 | + 'DESCRIPTION': 'Signal Documentation API', |
| 189 | + 'VERSION': '1.0.0', |
| 190 | + "COMPONENT_SPLIT_PATCH": True, |
| 191 | + "COMPONENT_SPLIT_REQUEST": True, |
| 192 | + 'SERVE_PUBLIC': True, |
| 193 | + 'SCHEMA_PATH_PREFIX': '/api/v[0-9]', |
| 194 | + 'SWAGGER_UI_SETTINGS': { |
| 195 | + 'docExpansion': 'list', |
| 196 | + 'filter': True, |
| 197 | + 'tagsSorter': 'alpha', |
| 198 | + }, |
| 199 | + 'SERVE_INCLUDE_SCHEMA': False, |
| 200 | +} |
| 201 | + |
| 202 | + |
153 | 203 | # Django chache
|
154 | 204 | # https://docs.djangoproject.com/en/4.2/topics/cache/#redis
|
155 | 205 |
|
|
0 commit comments