My web dev background has been exclusively Django, which I enjoy using as Python is my favorite language.
I am currently building a real-time chatroom, which means it relies heavily on async communication.
I'm currently learning Express.js but miss writing Python on the backend. Since Django is still lacking too many async features, Flask is the only other option for me if I want to use Python in the backend.
For those of you who are familiar with both Node/Express and Flask, which one do you think is objectively better for building an app which relies heavily on async features?
Videos
I'm getting ready to build out the back-end for my most recent website. Wondering what everyone here prefers and why, I usually go with the js stack but am interested in trying out the python route. (I'm a new grad this Dec. so I'm wondering which stack is the most 'sought' after, or at least the one I'll have better luck landing a job with from having experience in it). Be kind
Ok i have been reading online and i see that a lot of people and alot of companies are switching to nodejs im not a professional web developer but i like to build for personal use and for learning.
Is flask or django dying and what are the benefits of nodejs over flask (which is what i use)
JavaScript is the most popular language in the world in terms of Github repos, pushes and issues, and Stack Overflow questions asked. There are many other metrics by which the popularity of a language can be measured, and JavaScript does not always come out on top, sometimes it's not even top 5, but it's undeniably huge.
This should surprise no one; it's the only language the web browser speaks. So whatever back end you run, chances are you have a JavaScript front end. An ASP .NET app might have an Angular front end, a Symfony app has a Vue back end, a Flask app might have a React front end.
That's a lot of mindshare. JavaScript is becoming the lingua franca of coders. At least one well-known CS textbook with examples in Java is using JavaScript throughout its second edition. And since there is also a JavaScript back end runtime (Node), which uses the same language and same features (asynchronous, non-blocking, single threaded) then plenty of front end devs can turn their hands to back end development.
That doesn't mean that all other back end development must cease. The back end coding sector has always been a galaxy of variety, and Node is just one more star. It does occupy the same "quick to start, easy to maintain, tough to scale (but not impossible)" sphere that Flask does, and there will be a a bit of a brain drain going on. But at the same time, there will be Node devs, new to back end development, switching to Flask.
Flask isn't going away. Given Python's popularity with the scientific and statistics communities, Flask is going to be around for the kind of quick-start heavy lifting that Node can't manage yet. I don't see many web agencies sticking to it for too much longer; there it'll lose ground to Node. But there's nothing better for Big Data without going all-in for enterprise Java and the like.
Is flask or django dying and what are the benefits of nodejs over flask (which is what i use)
Lol no I don't think so. I work for a company that does application performance monitoring and there are tons of people using the Python agent, and it grows every day.
Express + NodeJS is actually a pretty similar library to Flask. Sinatra, Flask, and Express all have similar ideas: provide basic functionality to do web stuff while leaving a lot of flexibility and room for extensions.
NodeJS has a couple advantages over Python for backends IMHO:
-
Javascript is fast, and performs very well when rendering HTML templates. Jinja2 does OK but not as fast as Node.
-
Having the front end and back end of your application written in the same language can give you productivity benefits and makes it easier for everyone to work on both sides of the project. If you're one person making a web project, you can build the whole thing in one language.
-
Javascript folks are big on async which can help with certain performance problems (though you can do this in Python too).
Javascript is.... well, it's a weird language. It has issues. But it's getting better. And it actually is more similar to Python than I originally thought.
Reasons I like Python and Flask:
-
Python is awesome, I find it easier to debug things and be productive than I do in JS.
-
The libraries are very mature and stable, which is probably the biggest advantage. JS still has serious issues with this and the number of dependencies in the average NPM project is very high compared to Python.
-
The Flask library code and extensions are very easy to read and I can figure out how they work. Sometimes the JS libraries are difficult to grok.
-
The Python community is focused on code quality in a way that I really appreciate. There are a lot of Node folks who are fairly new to programming or who come to back end development from the front end and the meme is that the code quality from those folks is sometimes poor. But that's not really a criticism of the libraries themselves.
There's not really a right choice here; you can build awesome stuff with Express and you can build the same awesome stuff with Flask. IMHO you shouldn't be making language decisions based solely on performance, you should balance your performance needs with your productivity needs and your personal opinions. HOWEVER: making decisions about languages and frameworks based on internet hype is not a great idea.