The cheap way how to use Docker to deploy your FastAPI

Nuno Bispo
Analytics Vidhya
Published in
5 min readOct 6, 2020

--

FastAPI is a powerful API framework for Python that allows to quickly create and develop APIs in Python. But how to deploy those APIs ?

FastAPI logo

What is FastAPI?

From the FastAPI website:

FastAPI is a modern, fast (high-performance), web framework for building APIs with Python 3.6+ based on standard Python type hints.

What does this mean? It means that FastAPI allows to quickly build and develop APIs with some powerful features:

  • OpenAPI for API declaration
  • Automatic data model documentation with JSON Schema
  • Automatic client code generation in many languages
  • Automatic docs with Swagger UI (allows testing the API from the docs) and ReDoc
  • Standard Python type declarations, no new syntax needed
  • Sensible defaults
  • Validations for all Python types, including JSON dict and list, all the way to URL and Email
  • Security and Authentication with HTTP Basic, OAuth2 and passing of api keys

Building a quick API with FastAPI

First step is, of course, to install FastAPI with PIP:

--

--

Nuno Bispo
Analytics Vidhya

➡️ Content Creator 📜 ➡️ Software Builder 🧑‍💻 ➡️ Follow me for content about 🐍 Python 📘 Django 🧠 A.I.