Disallow API from being indexed

This commit is contained in:
Jake Howard 2022-10-02 19:20:40 +01:00
parent 6d0c25128c
commit 8844aad247
Signed by: jake
GPG key ID: 57AFB45680EDD477
3 changed files with 3 additions and 2 deletions

View file

@ -39,5 +39,5 @@ urlpatterns = [
schema_view.with_ui("swagger", cache_timeout=60 * 60), schema_view.with_ui("swagger", cache_timeout=60 * 60),
name="schema-swagger-ui", name="schema-swagger-ui",
), ),
path("", RedirectView.as_view(pattern_name="api:schema-swagger-ui")), path("", RedirectView.as_view(pattern_name="api:schema-swagger-ui"), name="index"),
] + api_urlpatterns ] + api_urlpatterns

View file

@ -7,4 +7,5 @@ Disallow: /
{% endif %} {% endif %}
Disallow: {% url "wagtailadmin_home" %} Disallow: {% url "wagtailadmin_home" %}
Disallow: {% url "api:index" %}
Sitemap: {{ sitemap }} Sitemap: {{ sitemap }}

View file

@ -45,7 +45,7 @@ urlpatterns = [
path("feed/", AllPagesFeed(), name="feed"), path("feed/", AllPagesFeed(), name="feed"),
path(".health/", include("health_check.urls")), path(".health/", include("health_check.urls")),
path("", include("website.legacy.urls")), path("", include("website.legacy.urls")),
path("api/", include("website.api.urls")), path("api/", include("website.api.urls", namespace="api")),
path("", include(favicon_urls)), path("", include(favicon_urls)),
# Some say it's a bad idea to serve media with Django - I don't care # Some say it's a bad idea to serve media with Django - I don't care
re_path( re_path(