Minimal configration for drf-spectacular

Onöy commandline interface
This commit is contained in:
YNorbert Klamann 2024-11-21 11:23:13 +00:00
parent d7d3fed833
commit 5ea2700dc1
2 changed files with 10 additions and 3 deletions

View File

@ -59,7 +59,7 @@ watchdog = "~=6.0"
whitenoise = "~=6.8" whitenoise = "~=6.8"
whoosh = "~=2.7" whoosh = "~=2.7"
zxing-cpp = {version = "*", platform_machine = "== 'x86_64'"} zxing-cpp = {version = "*", platform_machine = "== 'x86_64'"}
drf-spectacular = "*"
[dev-packages] [dev-packages]
# Linting # Linting

View File

@ -317,6 +317,7 @@ INSTALLED_APPS = [
"allauth.account", "allauth.account",
"allauth.socialaccount", "allauth.socialaccount",
"allauth.mfa", "allauth.mfa",
"drf_spectacular",
*env_apps, *env_apps,
] ]
@ -334,6 +335,7 @@ REST_FRAMEWORK = {
# Make sure these are ordered and that the most recent version appears # Make sure these are ordered and that the most recent version appears
# last # last
"ALLOWED_VERSIONS": ["1", "2", "3", "4", "5"], "ALLOWED_VERSIONS": ["1", "2", "3", "4", "5"],
"DEFAULT_SCHEMA_CLASS": "drf_spectacular.openapi.AutoSchema",
} }
if DEBUG: if DEBUG:
@ -355,8 +357,13 @@ MIDDLEWARE = [
"django.middleware.clickjacking.XFrameOptionsMiddleware", "django.middleware.clickjacking.XFrameOptionsMiddleware",
"allauth.account.middleware.AccountMiddleware", "allauth.account.middleware.AccountMiddleware",
] ]
SPECTACULAR_SETTINGS = {
# Optional to enable compression "TITLE": "Paperless API",
"DESCRIPTION": "Generated with drf-spectacular (unmodified) python manage.py spectacular --color --file schema.yml",
"VERSION": "5.0.0",
"SERVE_INCLUDE_SCHEMA": False,
# OTHER SETTINGS
}# Optional to enable compression
if __get_boolean("PAPERLESS_ENABLE_COMPRESSION", "yes"): # pragma: no cover if __get_boolean("PAPERLESS_ENABLE_COMPRESSION", "yes"): # pragma: no cover
MIDDLEWARE.insert(0, "compression_middleware.middleware.CompressionMiddleware") MIDDLEWARE.insert(0, "compression_middleware.middleware.CompressionMiddleware")