r/FastAPI • • Jul 29 '21

Question What does Flask have that FastAPI doesn't currently have?

I would like to help FastAPI/Starlette overtake flask to become the de facto framework for microservices and REST APIs. (I think Django projects generally target a different use case so I'm less concerned with trying to gain feature parity with Django)

I'm currently creating a comparison of similar 3rd party libs from each framework by cross-referencing:

I'm wondering if any of you with flask experience ever have feelings of:

I wish FastAPI had an equivalent of flask feature/plugin 'X'

Depending on the scope of the feature I'd like to try to implement or improve the biggest gaps between FastAPI and flask. Either by contributing to an active repo or creating my own.

For context, I've been working with FastAPI/Starlette/pydantic and asyncio on/off for around 2 years.

15 Upvotes

12 comments sorted by

View all comments

4

u/Gnlfbz Jul 30 '21

One of the things I would like to be easier in FastAPI is changing the logging around. On my recent project I wanted to get all of my logs into a JSON format and the work I had to do to make that work was kinda janky. Whereas when I have done it with flask in the past it has been pretty straightforward.

1

u/wrtbwtrfasdf Jul 31 '21

I just found this aiologger lib that has a JsonLogger and it reminded me of your post here. Hopefully since it's async and logs Json it helps you.

https://async-worker.github.io/aiologger/loggers_jsonlogger.html

3

u/Gnlfbz Jul 31 '21

That is nice, but one of the big things that I did was overload all the original logs so that 100% of the logs (even those that I dont create myself) are json. I originally went through the suggestions in https://github.com/tiangolo/uvicorn-gunicorn-fastapi-docker/issues/19 and https://github.com/tiangolo/fastapi/issues/898 to craft my solution. However I see the following now that I want to checkout later https://awesomeopensource.com/project/bobbui/json-logging-python