When comparing Flask vs ASP.NET Core, the Slant community recommends ASP.NET Core for most people. In the question“What are the best backend web frameworks?” ASP.NET Core is ranked 6th while Flask is ranked 7th. The most important reason people chose ASP.NET Core is:
Thanks to breakthroughs in ROSLYN compiler and the efforts of the .NET COre developer team, code written in C# can reach speeds just a step behind C++.
Specs
Ranked in these QuestionsQuestion Ranking
Pros
Pro Minimalist without losing power
Flask is very easy to get up and going, with vanilla HTML or with bootstrap pieces. It doesn't take much lines of Python to load Flask to get headers working, etc, and since it's all modular you don't have to have something you don't want in your application.
Pro Lots of resources available online
Flask is one of the most popular Python web frameworks, if not the most popular one. As such, there's plenty of guides, tutorials, and libraries available for it. A large number of important Python libraries, such as SQLAlchemy have libraries for Flask, which add valuable bindings to make the development process and the integration between these libraries and Flask as easy as possible.
Pro Extremely easy to build a quick prototype
Even though it's pretty minimalistic out of the box, Flask still provides the necessary tools to build a quick prototype for a web app right after a fresh install. With all the main components pretty much packed in the flask
package, building a simple web app in a single Python file is as easy as it gets.
Pro Very flexible
Flask gives developers a lot of flexibility in how they develop their web applications.
For example, the choice of not having an ORM, but instead choosing one suited to the task, or another area where Flask gives a lot of options to developers is the templating. They can use Jinja2, Flask's default templating language or choose from a number of different templating languages they desire.
Pro Great documentation
The official documentation is very thorough and complete. Everything is explained in-depth and followed by extremely well-explained tutorials that tackle real-world problems.
Pro Able to use ORM or "true SQL"
Pro Fast and getting faster
Thanks to breakthroughs in ROSLYN compiler and the efforts of the .NET COre developer team, code written in C# can reach speeds just a step behind C++.
Pro Multi platform
Can run on Windows, Linux and Mac (also Visual Studio Code editor).
Pro JSON optimization
In .NET Core 2.1 and 3.0, new APIs are added that make it possible to write JSON APIs that require less memory, using Span<T> and UTF8 strings, and improve throughput of applications like Kestrel, ASP.NET Core web server. See also Utf8JsonReader.
Pro Tutorials and documentation quality
Both microsoft and 3rd party tutorials are mostly of high quality and encourage you to use the industry best-practices.
Pro Built-in middleware
Built-in middleware featuring: Authentication, Cookie policy, Health Check, MVC, Session etc.
Pro Hosting
Ability to host on IIS, Nginx, Apache, Docker, or self-host in your own process.
Pro Ease of Use
Pro Security
It is a very secure platform.
Pro Tooling
Both VS and VSCode are powerful free IDEs that are well integrated with ASP.net Core. VS Community also allows for commercial use for projects with less than 5 developers.
Cons
Con Not async-friendly
Flask is explicitly not designed to handle async programming.
Con Setting up a large project requires some previous knowledge of the framework
Setting up a large project with Flask is not that easy considering how there's no "official" way of doing it. Blueprints are a useful tool in this regard but require some additional reading and are a bit tricky to get right for a beginner.
The lack of some defaults can also be problematic. Having to choose between different libraries for a certain task is never easy, especially if you have never worked with Flask before.
Con Threadlocals and globals used everywhere
The default way of creating applications in flask makes it hard to use reusable and clean code.
Con HTML-oriented, not API-oriented
Not necessarily designed for making APIs, though that is possible