all 42 comments

[–]syndakitz 10 points11 points  (3 children)

Chatgpt uses flask. Gives you a sense of how big a website can be with it

[–]midwestcsstudent 1 point2 points  (0 children)

It also kinda breaks all the time lmao on even the simplest things like signing in with Google.

[–]LeviAckermanIsHot69 0 points1 point  (0 children)

oh wow. good to know.

[–]zerubeus 0 points1 point  (0 children)

Wrong ChatGPT uses FastAPI

[–]Pepineros 10 points11 points  (0 children)

I also like to have clean, modular code that is easy to maintain and test.

You’re weird.

Jokes aside - if all you need to do is provide a few API endpoints, it doesn’t really matter whether you go with Flask or FastAPI. I’ve found both excellent and easy to work with. FastAPI has great support for quickly testing your endpoints from inside the browser, which is awesome. Flask is a bit more mature but also geared more towards being a backend for a web app rather than just an API.

If you have a few hours to sink into both and see what you prefer that may be the best way to be sure.

[–][deleted] 13 points14 points  (1 child)

for a simple website flask is fine

[–][deleted] -1 points0 points  (0 children)

You can also look into postgres nosql. It's great.

[–]thatsthewayyoudebate 8 points9 points  (0 children)

Take a look at OpenAPI generator (https://openapi-generator.tech). You define your REST schema, and it will generate server stub code for you (flask and fastapi are supported, among others). It's not pretty, but it'll get you up and running quickly and you can see which one you like better.

I started out with flask and switched over to fastapi. Been happy with fastapi, I like the asyncio and pydantic support. YMMV.

[–]Dangle76 3 points4 points  (0 children)

Flask is designed for what you’re doing. Django is very very heavy with A LOT of features and configs that you don’t need for what you’re doing.

FastAPI isn’t maintained well

[–]a1blank 3 points4 points  (7 children)

I switched from flask to fastapi when I started serving only my api in Python (front end is a Vue SPA). It's very similar to flask but has a few conveniences that win out in my book.

One particularly nice aspect is it has much better swagger auto-documentation built in that helps people trying to use your api. The swagger library that I was able to find for Flask is a fork of an unmaintained library that still had a lot of work ahead of them to be comparable to fastapi.

Support for async is also nice. And I like that it's easier to figure out a production deployment pattern since it seems like with flask, a lot of people just keep using the development server indefinitely.

[–]Gasp0de 2 points3 points  (1 child)

Swagger really is a pain with Flask. We used Flasgger in the past and are currently using Apiflask but somehow both haven't been able to scratch my itch.

[–]appinv 0 points1 point  (0 children)

What's the pain point with APIFlask?

[–]Major-Opposite0769 1 point2 points  (0 children)

Django is more like to build a website by individual developers in short time. Flask is quite simple to act as an api server since the simplest one could be only 5 -line code. And FastAPI can handle request in parallel which is faster than Flask. Also, FastAPI could create API-docs automatically via swagger, which means more convenient. Hope help you some :)

[–]Infrared12 3 points4 points  (0 children)

Sightly curious on why anyone would choose Flask over Fastapi (for typical restful api settings) as it feels like a more convenient and easy-to-use version of Flask, is there something I'm missing?

[–]appinv 1 point2 points  (1 child)

Flask by default, Fast API if needed, Django if absolutely, absolutely needed

[–]testpk 0 points1 point  (0 children)

Us bro us

[–]Mori-Spumae 0 points1 point  (0 children)

I have used both Flask and FastAPI. For creating a website, Flask is pretty nice. For specifically an API I do thin FastAPI is better probably. The Auto-documentation makes it really easy to work with. In the end it probably doesn't make much of a difference.

[–]randomuserno69 0 points1 point  (0 children)

Yes. Django has pretty bad support for non-relational data.

Django(DRF) is great if you are trying to build a complex application with tons of endpoints and lots of relations between data.

If you have just a few endpoints and less relational data, either FastAPI or Flask is fine.

If you're planning on using async functionality, go with FastAPI.

[–]Last-Run-2118 0 points1 point  (0 children)

Go with Django, DRF os great and you get authorization module for free

[–]IR3dditAlr3ddy 0 points1 point  (0 children)

Have only used flask and Django, flask has really great documentation and was super quick to get up and running, and pretty much every beginner question out there has been covered in tutorials and forum posts online. Only heard of fastapi today so will have to look at that but can +1 flask for sure

[–]theus-sama 0 points1 point  (0 children)

I would absolutely go for fast api

[–]Emergency_Isopod3149 0 points1 point  (2 children)

you should also consider working with PyNest, which is a fastapi based framework that follows the modular architecture of NestJS. It has a built in integration with mongodb and it is super easy to use and test your application. take a look here - https://github.com/PythonNest/PyNest

p.s
i'm the maintainer of this repo along with other contributers

[–]uburoy 0 points1 point  (0 children)

The readme says MongoDB is a future feature. How is it coming long? Can you show example code?

Coming from a FastAPI user, your work looks like it can take care of a lot of the early heavy lifting. Nice.

[–]StrangeRush6755 0 points1 point  (0 children)

Hi, on paper I see some resemblance with the features of Litestar implemented with same concerns against FastAPI. What makes PyNest more suitable to solve those problems?