diff --git a/backend/core/settings/base.py b/backend/core/settings/base.py index 9584d58..1d477ea 100644 --- a/backend/core/settings/base.py +++ b/backend/core/settings/base.py @@ -41,6 +41,7 @@ 'django_extensions', 'rest_framework', 'django_filters', + 'drf_yasg', 'core', 'accounts', 'products', diff --git a/backend/core/urls.py b/backend/core/urls.py index 94019f9..76d3807 100644 --- a/backend/core/urls.py +++ b/backend/core/urls.py @@ -3,9 +3,22 @@ from django.conf.urls import include from django.conf.urls.static import static from django.conf import settings +from rest_framework import permissions +from drf_yasg.views import get_schema_view +from drf_yasg import openapi from .views import stripe_webhook +schema_view = get_schema_view( + openapi.Info( + title="GetIt API", + default_version='v1', + description="API Documentation" + ), + public=True, + permission_classes=(permissions.AllowAny,), +) + urlpatterns = [ path('admin/', admin.site.urls), path('api/token/', include('auth.urls')), @@ -13,4 +26,5 @@ path('api/events/', include('events.urls')), path('api/tickets/', include('tickets.urls')), path('api/stripe/webhook/', stripe_webhook, name='stripe-webhook'), + path('swagger/', schema_view.with_ui('swagger', cache_timeout=0), name='schema-swagger-ui'), ]+ static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT) diff --git a/backend/requirements.txt b/backend/requirements.txt index cb55edf..fdcb310 100644 --- a/backend/requirements.txt +++ b/backend/requirements.txt @@ -25,3 +25,4 @@ tomli==2.0.1 typing_extensions==4.6.3 tzdata==2022.6 stripe +drf-yasg==1.21.7 \ No newline at end of file