diff --git a/sigi/templates/sigi/api/redoc.html b/sigi/templates/sigi/api/redoc.html new file mode 100644 index 0000000..07650ce --- /dev/null +++ b/sigi/templates/sigi/api/redoc.html @@ -0,0 +1,21 @@ + + + + SIGI ReDoc documentation + + + + + + + + + + + + \ No newline at end of file diff --git a/sigi/templates/sigi/api/swagger-ui.html b/sigi/templates/sigi/api/swagger-ui.html new file mode 100644 index 0000000..0d2ab1c --- /dev/null +++ b/sigi/templates/sigi/api/swagger-ui.html @@ -0,0 +1,28 @@ + + + + SIGI Swagger documentation + + + + + +
+ + + + \ No newline at end of file diff --git a/sigi/urls.py b/sigi/urls.py index 843dc04..680498b 100644 --- a/sigi/urls.py +++ b/sigi/urls.py @@ -14,10 +14,11 @@ Including another URLconf 2. Add a URL to urlpatterns: path('blog/', include('blog.urls')) """ from rest_framework.schemas import get_schema_view -from django.contrib import admin -from django.urls import path, include from django.conf import settings from django.conf.urls.static import static +from django.contrib import admin +from django.urls import path, include +from django.views.generic import TemplateView urlpatterns = [ path("casas/", include("sigi.apps.casas.urls")), @@ -30,7 +31,7 @@ urlpatterns = [ path("admin/ocorrencias/", include("sigi.apps.ocorrencias.admin_urls")), path("admin/", admin.site.urls), path( - "api/", + "api/doc/schema.yaml", get_schema_view( title="SIGI Open API Schema", description="API for SIGI opendata", @@ -38,6 +39,22 @@ urlpatterns = [ ), name="openapi-schema", ), + path( + "api/doc/swagger-ui/", + TemplateView.as_view( + template_name="sigi/api/swagger-ui.html", + extra_context={"schema_url": "openapi-schema"}, + ), + name="swagger-ui", + ), + path( + "api/doc/redoc/", + TemplateView.as_view( + template_name="sigi/api/redoc.html", + extra_context={"schema_url": "openapi-schema"}, + ), + name="redoc", + ), path("api/eventos/", include("sigi.apps.eventos.api_urls")), path("tinymce/", include("tinymce.urls")), path("accounts/", include("sigi.apps.home.accounts_urls")),