13
13

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

django rest framework : swagger

Last updated at Posted at 2018-06-26

description

  • rest framework で作成した api の一覧を自動生成する.
  • swagger module を用いる

swaggerとは

以下参照されたし
Swaggerの概要をまとめてみた

参考動画

有効化済み path 一覧が表示される
test.gif

swagger module install

shell
pip install django-rest-swagger

enable swagger

rest_project/settings.py
# 追記
INSTALLED_APPS = [
    ...,
    'rest_framework_swagger',
]

swagger url setting

api/urls.py
# 追記
from rest_framework_swagger.views import get_swagger_view
schema_view = get_swagger_view(title='API Lists')

# 配列へ追記
urlpatterns = [
    ...,
    url(r'^swagger/', schema_view), 
]

open swagger page

shell
python manage.py runserver 0.0.0.0:9000
  • open http://localhost:9000/api/swagger/

以上.

13
13
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
13
13

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?