diff --git a/demo/demo/settings.py b/demo/demo/settings.py index a41f5b2..7d6399d 100644 --- a/demo/demo/settings.py +++ b/demo/demo/settings.py @@ -44,6 +44,7 @@ INSTALLED_APPS = ( 'rest_auth.registration', 'allauth.socialaccount', 'allauth.socialaccount.providers.facebook', + 'rest_framework_swagger', ) MIDDLEWARE_CLASSES = ( @@ -106,7 +107,7 @@ TEMPLATES = [ }, ] -REST_SESSION_LOGIN = False +REST_SESSION_LOGIN = True EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend' SITE_ID = 1 ACCOUNT_EMAIL_REQUIRED = False @@ -119,3 +120,8 @@ REST_FRAMEWORK = { 'rest_framework.authentication.TokenAuthentication', ) } + +SWAGGER_SETTINGS = { + 'LOGIN_URL': 'login', + 'LOGOUT_URL': 'logout', +} diff --git a/demo/demo/urls.py b/demo/demo/urls.py index 3813e5a..e66bc9d 100644 --- a/demo/demo/urls.py +++ b/demo/demo/urls.py @@ -2,6 +2,8 @@ from django.conf.urls import include, url from django.contrib import admin from django.views.generic import TemplateView, RedirectView +from rest_framework_swagger.views import get_swagger_view + urlpatterns = [ url(r'^$', TemplateView.as_view(template_name="home.html"), name='home'), url(r'^signup/$', TemplateView.as_view(template_name="signup.html"), @@ -38,4 +40,5 @@ urlpatterns = [ url(r'^account/', include('allauth.urls')), url(r'^admin/', include(admin.site.urls)), url(r'^accounts/profile/$', RedirectView.as_view(url='/', permanent=True), name='profile-redirect'), + url(r'^docs/$', get_swagger_view(title='API Docs'), name='api_docs') ] diff --git a/demo/requirements.pip b/demo/requirements.pip index c68a521..2a7d3c1 100644 --- a/demo/requirements.pip +++ b/demo/requirements.pip @@ -1,4 +1,6 @@ django>=1.8.0 django-rest-auth==0.8.1 +djangorestframework==3.5.1 django-allauth>=0.24.1 six==1.9.0 +django-rest-swagger==2.0.7 diff --git a/demo/templates/base.html b/demo/templates/base.html index 03a2b73..a697cc3 100644 --- a/demo/templates/base.html +++ b/demo/templates/base.html @@ -60,6 +60,7 @@