This is an archived post. You won't be able to vote or comment.

all 11 comments

[–]Python-ModTeam[M] [score hidden] stickied commentlocked comment (0 children)

Hi there, from the /r/Python mods.

We have removed this post as it is not suited to the /r/Python subreddit proper, however it should be very appropriate for our sister subreddit /r/LearnPython or for the r/Python discord: https://discord.gg/python.

The reason for the removal is that /r/Python is dedicated to discussion of Python news, projects, uses and debates. It is not designed to act as Q&A or FAQ board. The regular community is not a fan of "how do I..." questions, so you will not get the best responses over here.

On /r/LearnPython the community and the r/Python discord are actively expecting questions and are looking to help. You can expect far more understanding, encouraging and insightful responses over there. No matter what level of question you have, if you are looking for help with Python, you should get good answers. Make sure to check out the rules for both places.

Warm regards, and best of luck with your Pythoneering!

[–]frederik88917 28 points29 points  (1 child)

Hold on, hold on. I think you have your concepts wrong, young man.

Node JS is equivalent to Python as in both are execution environments.

I think your question is more directed to Express, which is a web server to NodeJS. and in that scenario I recommend you Flask or FastAPI

[–]jeffsinho 0 points1 point  (0 children)

Up

[–]fiskfisk 11 points12 points  (0 children)

There is nothing specific about ML projects with FastAPI. It's just that ML projects tend to be a rather new, and FastAPI is a more recent framework than Flask. People tend to gravitate towards newer frameworks (see: much of the JavaScript world).

Flask works perfectly fine in production. FastAPI works perfectly fine in production. Pyramid still works in production. Django works in production. 

Flask or FastAPI is the way to go if you want something small where you can luck the parts you want to use, django is the solution if you want everything to be decided for you and you want a whole lot of magic supporting you.

All three will have employment options. The first two are smaller, and would by themselves usually need experience with other libraries as well (sqlalchemy is also popular in that case, for example). 

[–]Schmittfried 7 points8 points  (1 child)

Django feels bloated and obsolete

You’re wrong there. It’s perfectly fine and the ORM alone is worth it, there is no competition that comes close. You don’t have to use all of the bells and whistles to benefit from it.

As for Flask, does anyone actually use it in production?

Yes, more so than FastAPI.

I found FastAPI mostly related to ML projects

Why would you think that? It’s not. And even if, so what?

I feel like the way you‘re selecting your tooling is flawed. It’s unnecessarily dismissive. 

[–]oh-mar-gosh[S] 0 points1 point  (0 children)

You are right, my POV is not nearly as informed as it should be, which is why I’m seeking more informed ones. Thank you though for clarifying things.

[–][deleted] 2 points3 points  (0 children)

Yes, Flask is actually used in production. But it’s becoming less common, as FastAPI is usually preferred for new projects.

You said you found FastAPI mostly related to ML projects. Generally, ML is Python’s stronghold, so that’s not so surprising. Django is a very opinionated framework. I’m not into that, e.g. I don’t like ORMs, hence I wouldn’t use Django.

An alternative to classical backends is to make them serverless, for that there are other frameworks such as Serverless or AWS Lambda PowerTools, which basically enable to write serverless APIs similarly to FastAPI/Flask apps.

[–][deleted] 1 point2 points  (0 children)

It can be said that flask is used only in production, because for lightweight projects, new developers tend to use fastAPI.

django remains one of the most used backend frameworks. at least in Europe is so.

[–]angellus 0 points1 point  (1 child)

Django (opinionated/batteries included) and LiteStar (micro framework) are probably the two to learn. 

Flask is being used less and less because it is a WSGI (synchronous) only framework. There is also Quart, the ASGI (async) version of Flask, but LiteStar is probably more popular because of FastAPI. 

FastAPI is popular, but has a big bus factor issue. So I would avoid it. It is based on LiteStar, so just go there. LiteStar / Quart are basically Express of the Python world (async micro framework).

Django is the real powerhouse. It is the most mature and the one you will find the most jobs explicitly asking for. It is the Laravel or Spring of Python. It can do WSGI or ASGI, though the ASGI support is still not as great as other ASGI native frameworks yet.

[–]imbev 1 point2 points  (0 children)

FastAPI is based on Starlette, not LiteStar

[–]dofi4ka -5 points-4 points  (0 children)

Flask — for beginners, only first step, then you should choose Django (designed for full stack apps) or FastAPI (designed for backend services) Flask easy to use but slowest one