FastAPI
1 hour 22 minutes done from 4 hours
FastAPI
Very fast (built on ASGI unlike flask which is built on WSGI)
in built with swagger UI documentation and ReDoc Documentation
supports pydantic for data validation
Totally Based upon open API (Linux foundation, defines how to create an API) and json schema
Starlette features
Supports - SQL, NoSQL, graphQL
ASGI vs WSGI
Swagger and ReDOC Documentation
Pydantic
Streamlit Features
Supports Multiple Databases
Additional Support
works with gunicorn
jwt authentication
Requirements
Python version should be 3.6+
pip install fastapi[all]
pip install gunicorn
pip install uvicorn[standard]
from pydantic import BaseModel
uvicorn -b 0.0.0.0:5020 main:app --reload
# main is the main.py file
# app = FastAPI() instance
# -b binds to particular host and port
# --reload automatically refreshes as soon as we make changes to main.py and save
FastAPI reads the file line-by-line so if there is any error at the start, we don't reach to the lower part of the file
Reference for Further Reading
4 hour long video: https://www.youtube.com/watch?v=7t2alSnE2-I
Last updated
Was this helpful?