diff --git a/core/settings/__init__.py b/core/settings/__init__.py index 49e17de..fc0422a 100644 --- a/core/settings/__init__.py +++ b/core/settings/__init__.py @@ -48,6 +48,7 @@ INSTALLED_APPS = [ 'corsheaders', 'rest_framework_simplejwt.token_blacklist', 'django_filters', + 'rest_framework_swagger', ] EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend' @@ -107,7 +108,8 @@ REST_FRAMEWORK = { ], 'DEFAULT_FILTER_BACKENDS': ( 'django_filters.rest_framework.DjangoFilterBackend', - ) + ), + 'DEFAULT_SCHEMA_CLASS': 'rest_framework.schemas.coreapi.AutoSchema', } REST_USE_JWT = True @@ -151,7 +153,7 @@ USE_TZ = False # https://docs.djangoproject.com/en/2.2/howto/static-files/ STATIC_URL = '/static/' - +STATICFILES_DIRS = [os.path.join(BASE_DIR, 'static')] EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend' EMAIL_USE_TLS = True diff --git a/core/urls.py b/core/urls.py index 798196c..e9b653b 100644 --- a/core/urls.py +++ b/core/urls.py @@ -35,7 +35,9 @@ from qrtr_account.views import (AccountViewSet, TwitterLogin) from connection.views import ConnectionViewSet, ConnectionTypeViewSet - +from rest_framework_swagger.views import get_swagger_view + +schema_view = get_swagger_view(title="Qrtr API") router = routers.DefaultRouter() router.register(r'users', UserViewSet) @@ -65,6 +67,7 @@ apipatterns = [ urlpatterns = [ path('admin/', admin.site.urls), path('api/v1/', include(apipatterns), name='api'), + path('api/v1/docs', schema_view), path('accounts/', include('allauth.urls')), path('accounts/profile/', ConfirmEmailSuccessView.as_view()), ]