Skip to content

Commit

Permalink
Switch to drf-yasg
Browse files Browse the repository at this point in the history
Closes #27
  • Loading branch information
jacebrowning committed Jan 3, 2020
1 parent 052e6c9 commit 555e1d0
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 5 deletions.
3 changes: 2 additions & 1 deletion {{cookiecutter.project_name}}/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
* Windows: http://mingw.org/download/installer
* Mac: http://developer.apple.com/xcode
* Linux: http://www.gnu.org/software/make
* pipenv: http://docs.pipenv.org
* Python: `$ pyenv install`
* Poetry: https://python-poetry.org/docs/#installation

To confirm these system dependencies are configured correctly:

Expand Down
2 changes: 1 addition & 1 deletion {{cookiecutter.project_name}}/config/settings/default.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
'corsheaders',
'memoize',
'rest_framework',
'rest_framework_swagger',
'drf_yasg',

'{{cookiecutter.project_name}}.api',
'{{cookiecutter.project_name}}.core',
Expand Down
2 changes: 1 addition & 1 deletion {{cookiecutter.project_name}}/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ django-memoize = "*"
# API
djangorestframework = "^3.7"
drf-nested-routers = "*"
django-rest-swagger = "*"
drf-yasg = "*"

# Storage
dj-database-url = "=0.4.2"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
from django.conf.urls import include, url
from django.conf import settings

from rest_framework import routers
from rest_framework_swagger.views import get_swagger_view
from drf_yasg.views import get_schema_view
from drf_yasg import openapi


# Root
Expand All @@ -16,10 +18,19 @@

# URLs

schema_view = get_schema_view(
openapi.Info(
title="{{cookiecutter.project_name}}",
default_version='0',
description="The API for {{cookiecutter.project_name}}.",
),
url=settings.BASE_URL,
)

urlpatterns = [
url('^', include(root.urls)),

url('^client/', include('rest_framework.urls')),

url('^docs/', get_swagger_view(title="{{cookiecutter.project_name}} API")),
url('^docs/', schema_view.with_ui('swagger')),
]

0 comments on commit 555e1d0

Please sign in to comment.