diff --git a/{{cookiecutter.project_slug}}/config/settings/base.py b/{{cookiecutter.project_slug}}/config/settings/base.py index 52798146..1989fd8c 100644 --- a/{{cookiecutter.project_slug}}/config/settings/base.py +++ b/{{cookiecutter.project_slug}}/config/settings/base.py @@ -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... diff --git a/{{cookiecutter.project_slug}}/config/settings/production.py b/{{cookiecutter.project_slug}}/config/settings/production.py index 15d3a768..5de0529e 100644 --- a/{{cookiecutter.project_slug}}/config/settings/production.py +++ b/{{cookiecutter.project_slug}}/config/settings/production.py @@ -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... # ------------------------------------------------------------------------------