dev_urls: Make requests to /docs redirect to the index.

This makes it easier to browse to the docs in development mode, and
more closely matches ReadTheDocs production.
This commit is contained in:
Alex Vandiver 2024-03-19 15:06:49 +00:00 committed by Tim Abbott
parent f758ca596b
commit 6ad777c86f
2 changed files with 3 additions and 1 deletions

View File

@ -505,6 +505,7 @@ def write_instrumentation_reports(full_suite: bool, include_webhooks: bool) -> N
"config-error/(?P<error_name>[^/]+)", "config-error/(?P<error_name>[^/]+)",
"confirmation_key/", "confirmation_key/",
"node-coverage/(?P<path>.+)", "node-coverage/(?P<path>.+)",
"docs/",
"docs/(?P<path>.+)", "docs/(?P<path>.+)",
"casper/(?P<path>.+)", "casper/(?P<path>.+)",
"static/(?P<path>.+)", "static/(?P<path>.+)",

View File

@ -7,7 +7,7 @@ from django.contrib.staticfiles.views import serve as staticfiles_serve
from django.http.request import HttpRequest from django.http.request import HttpRequest
from django.http.response import FileResponse from django.http.response import FileResponse
from django.urls import path from django.urls import path
from django.views.generic import TemplateView from django.views.generic import RedirectView, TemplateView
from django.views.static import serve from django.views.static import serve
from zerver.views.auth import login_page from zerver.views.auth import login_page
@ -52,6 +52,7 @@ urls = [
"show_indexes": True, "show_indexes": True,
}, },
), ),
path("docs/", RedirectView.as_view(url="/docs/index.html")),
path( path(
"docs/<path:path>", "docs/<path:path>",
serve, serve,