So I decided to touch a new framework.
As mentioned above, I did not want to learn a new language because what I want to do is create things and programming is just a means to an end. (I was trying to get introduced to the Go language at one point, but gave it up due to lack of time).
After much research, I learned that a framework called FastAPI was coming along quite well.
Advantages of FastAPI
When I touched FastAPI, it was a revolution.
I can include
typedefs
in Python.
I was very happy to see this feature, as I had a hard time with DX dropping due to the lack of types in Django development at my internship.
Ability to output
API documentation
by default.
Genius.
It's very effective in the division of labor with the frontend.
fast
.
cf.
Python web framework performance comparison
FastAPI settings
from
app.routers
import
auth_router
,
health_router
,
user_router
from
fastapi
import
FastAPI
from
fastapi.staticfiles
import
StaticFiles
fastapi_app
=
FastAPI
()
# routers
fastapi_app
.
include_router
(
health_router
,
tags
=
[
"health"
],
prefix
=
"/health"
)
# to mount Django
fastapi_app
.
mount
(
"/django"
,
django_app
)
fastapi_app
.
mount
(
"/static"
,
StaticFiles
(
directory
=
"static"
),
name
=
"static"
)
fastapi_app
.
mount
(
"/media"
,
StaticFiles
(
directory
=
"media"
),
name
=
"media"
)
I am happy to build my ideal style. Since it is in the template repository, I hope you will use it.
As I am new to FastAPI, I am sure there are some weird things I am doing. Please send me Issue, PR.
I found it while writing this article.
I think it differs from this project in that it uses wsgi to run Django and does not support async for the Django ORM.
Built on Forem — the open source software that powers DEV and other inclusive communities.