Skip to main content

Swagger documentation in Django

Project description

Django Swagger Render

Getting Started

Prerequisites

  • python >= 3.5
  • Django >= 2.0

Installation

Install using pip

pip install django-swagger-render

Add 'swagger_render' to your INSTALLED_APPS setting.

INSTALLED_APPS = [
    ...
    'swagger_render',
]

Create the folder where you will store your documentation

mkdir docs

Create the index.yml file with some OPENAPI or Swagger specifications

touch docs/index.yml

Serve your documentation files

urlpatterns += static('/docs/', document_root='docs')

Add SWAGGER_YAML_FILENAME setting to your settings.py

SWAGGER_YAML_FILENAME = '/docs/index.yml'

Add the SwaggerUIView to your urls

from swagger_render.views import SwaggerUIView


urlpatterns = [
    ...
    path('swagger/', SwaggerUIView.as_view()),
]

Voila!

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django-swagger-render-0.1.1.tar.gz (2.5 MB view hashes)

Uploaded Source

Built Distribution

django_swagger_render-0.1.1-py3-none-any.whl (2.5 MB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page