from django.http import HttpResponseNotFound from django.views import View class _DisabledSchemaView(View): def dispatch(self, request, *args, **kwargs): return HttpResponseNotFound("Schema endpoint is disabled.") class SpectacularAPIView(_DisabledSchemaView): pass class SpectacularSwaggerView(_DisabledSchemaView): pass class SpectacularRedocView(_DisabledSchemaView): pass