Your Python Flask API is Nothing Without Swagger UI.

Sean Bradley
4 min readApr 17, 2019

You don’t believe me, look at this.

Much better.

Once you’ve created the Swagger UI layer, your API documentation is much more presentable to pass onto your line managers, colleagues and third party consumers.

This is a Python Flask Specific implementation. It is expected that you already have at least a minimal Flask REST API with a few end points ready to be documented. If not, you can get the code from here, https://github.com/Sean-Bradley/Seans-Python3-Flask-Rest-Boilerplate
and then run # pip install -r requirements.txt

Lets get Started

  1. Open console or bash
    # pip install flask_swagger_ui
  2. Open your app.py where you instantiated Flask and add to the top
    from flask_swagger_ui import get_swaggerui_blueprint
  3. Add a folder to the root of your project and name it static.

4. Create a new file in it and name it swagger.json

5. Add some Swagger specific blueprint code after you instantiate Flask

--

--

Sean Bradley
Sean Bradley

Written by Sean Bradley

Developer of real time, low latency, high availability, asynchronous, multi threaded, remotely managed, fully automated and monitored solutions.