set SERVERS in production settings instead of base settings (#3609)

fixes https://github.com/cookiecutter/cookiecutter-django/issues/3593
This commit is contained in:
ghazi-git 2022-12-06 14:26:24 -05:00 committed by GitHub
parent 33af8e3988
commit fc081ce1fe
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 4 deletions

View File

@ -350,10 +350,6 @@ SPECTACULAR_SETTINGS = {
"DESCRIPTION": "Documentation of API endpoints of {{ cookiecutter.project_name }}",
"VERSION": "1.0.0",
"SERVE_PERMISSIONS": ["rest_framework.permissions.IsAdminUser"],
"SERVERS": [
{"url": "http://127.0.0.1:8000", "description": "Local Development server"},
{"url": "https://{{ cookiecutter.domain_name }}", "description": "Production server"},
],
}
{%- endif %}
# Your stuff...

View File

@ -368,5 +368,15 @@ sentry_sdk.init(
traces_sample_rate=env.float("SENTRY_TRACES_SAMPLE_RATE", default=0.0),
)
{% endif %}
{% if cookiecutter.use_drf == "y" -%}
# django-rest-framework
# -------------------------------------------------------------------------------
# Tools that generate code samples can use SERVERS to point to the correct domain
SPECTACULAR_SETTINGS["SERVERS"] = [ # noqa F405
{"url": "https://{{ cookiecutter.domain_name }}", "description": "Production server"}
]
{%- endif %}
# Your stuff...
# ------------------------------------------------------------------------------