Effective Flask or Django? Which is better For You ||

Flask vs Django

Answer 1 :

Flask seems to me simpler. There is no “magic”, only a small API to learn. In addition, although I intend to implement the MVC architecture, Pylons seems to have enforced it as a design decision from the beginning. The Django community is very strong, especially on IRC. I found that none of the forums are very popular with them, but I found it a bit strange. Flask…well, Flask is nothing. There is a Werkzeug community and a Jinja2 community. By searching these two sites, I found a lot of information I need. I did not find them on IRC because I am working and have been blocked.

/r/django is more active than /r/flask.

The fact is, with Flask, I don’t need support. The document is very good, and very small, there is not much wrong in fact. When I develop more advanced requirements, I am learning different parts of the framework, and until then, they have been in barriers. Before using Django, I often found myself having to learn why things are structured in this way before learning the system. An example of this is form processing-on Django, I remember having to learn the Forms model and all its configuration. Then, I have to learn form validation and how to process the form in the view (by branching logic based on request type). Finally, I must learn how to bind the form to the model or use ModelForm.

With Flask…, as far as I know there is no form processing. I built the form with HTML (and wrote some helper functions in the process), temporarily verified the data, and then wrote SQL to put it into the database. There are some extensions that add form processing capabilities to Flask, but I have not used them.

In this use case, competent Django developers can build and run CRUD forms in less time than competent Flask developers-but when I think I am “capable”, I will develop my own helper function Libraries, and architectural conventions, and in the process will learn a lot about Python. This is actually not a fair comparison-no one sits down and has only one module and writes everything else from scratch.

I think in the end I will eventually use Django for prototyping and rapid application development, and use Flask (or its components, Werkzeug and Jinja2) to write models that are not well-defined or not very suitable for Django. I don’t think that one whole is better than another, but I support Flask for new Python programmers.

Answer 2 :

I just built a large site with Flask, and I definitely learned a hard way that using the community (django) is sometimes easier than building everything from scratch.

In my opinion, SQL Alchemy is very bad. Everything you need to do must be clear, and if the cascade is not set up correctly, the default option will be set to loose data. You did learn a lot (for example, the default jsonify-make a json response-does not apply to AJAX requests in Internet Explorer), because you are closer to the basic code with more control, but it depends on how much you need to spend How much time and energy. You want to spend on building a website.

Flask does not have search engine support like Haystacks, so I had to do it myself. Generally, in Django, if you want to accomplish something quickly, you can use a good enough extension to accomplish what you want.

I think there is a serious flaw in routing in Flask. The decorator method does not allow meaningful ordering of routes without using some very strange syntax or the addition of a custom URL parser. Even so, if you have many URLs of the same type, in the case of a 404 response, there should be a way to move to the next possible URL. I’m not sure if Django does this, but it should.

One of the better aspects of Flask is the generated management interface Flask-Admin. This is not what I wrote, but as far as the administrator of customizable model generation is concerned, it is far better than anything else I have seen. Compared to CRUD, Django is undoubtedly a disaster. But everyone can now build their own forms.

The problem now is that I have encountered a lot of problems on Flask, and I really like to meet my needs. But I find it difficult to set it up in a reasonable project structure for a very large project. I think I want to develop my own Flask-Skeleton, and actually give me a reasonable benchmark to set up a new application every time.

Answer 3 :

Let’s clear a misunderstanding from the beginning: Flask and Django can finally do the same thing. You can use any framework to build any website, whether it is a very small website or a very large website. The difference is the method.

Flask will grow with your application. You can start from:

from flask import Flask
app = Flask(__ name__) @app.route“/”)
def hello():
return “ Hello World!”

That is a complete and working application. Of course, it doesn’t do anything interesting, but you can expand from this example to more complex applications. For example, you can add a parameter to make it say “Hello [name]!”. Instead of the general “Hello World!”:Import flask from flask flask app = Flask (_ name _) @ app.route ("/") def hello (): return "Hello World!")

You can slowly build more interesting examples.

Django is a bit different. It says it comes with a battery, and it does.

Generally, you will create a new project with the following command:django-admin startproject myproject

This will create the minimum file structure needed to start building. Before you start building anything useful, you need to understand how everything fits together. This may be useful for experienced developers, but it may be a little overwhelming at first.

Once you enter a more complex project, Flask can become overwhelmed. For example, there are plugins that can be used for authentication, but it is not built-in, and the documentation is usually poor. With Django, you can follow the standard authentication method, which is already built-in and provides an excellent tutorial, so it’s easier.

For beginners, I still recommend Flask. It’s much simpler to get started and less “magic” than Django. You don’t need to use commands that “magically” create files. You start with a file, and then start from there.

Once you understand Flask, learning Django will not be that difficult. Although their methods are different, they are fundamentally more similar than differences. Generally, starting with Flask does provide a good starting point for learning back-end web development.

Answer 4 :

Let me take you on a wonderful journey.

You start cycling.

As a rookie, you will fall into it many times.

And, injured again and again.

You are now learning.


You start cycling. However, the plot turned.

You learn to ride a bicycle by observing others.

You sit on their backs and see how smooth they ride.

Now, two situations can happen:

  1. You can copy them perfectly and become a professional.
  2. You messed up things badly and eventually hurt yourself, confused about how things were done.

Now, the choice is yours. You know your talents better than anyone.

Speaking of which, Flask and Django are great in their respective ways.

Flask can help you learn and understand how things go in back-end development and how to improve the front-end exponentially with the correct back-end settings. Compared to Django, the learning curve is much softer. But the problem lies in messing up on a large scale and slowing down production.

With Django, you can settle down and prepare for professional development, but if you are a beginner, you may end up messing up the basics and be confused for a long time by introducing new concepts. However, compared to today’s Flask, Django is practically fast and choose wisely efficient.

Therefore, I suggest that if you want to start using python for web development, please use flask first, and then clear the basics.

Basically, I mean you should be good enough to build your own CMS (basically a blog) because they can quietly check your progress.

You will show familiarity with words such as migration, bad request, modal, view, and various things.

After doing this, you can definitely start your own work as a Django developer.

That will be easy to start.

I have also suffered from this kind of confusion, but I chose the right one by judging my talents!

thanks for reading!

Suggestions would be greatly appreciated.Image source: Google

If you need any advice on how to start developing with flask or django, please DM me for free. I would be happy to help you.

-Quiet (confused) developer

Answer 5 :

Today, technology is becoming more and more powerful to facilitate learning. The programming language competition has now become a marathon, it is too endless. When web developers use Python as a server-side programming language, there are always multiple frameworks to choose from. He can choose to use the complete Python Web framework to speed up the development of complex and comprehensive Web applications by using some powerful tools and functions. He can also use the tiny lightweight Python web framework to develop simple web applications without spending any extra time and effort.

Python programmers prefer Flask and Django. Since Django is a full-stack Web framework for Python, Flask is a lightweight and extensible Python Web framework. Django was developed based on a method that includes batteries. It enables programmers to complete simple web development tasks without using any third-party tools and libraries.

By definition:

  1. Flask: This is a micro-framework that provides the basic functions of a web application. The framework does not rely on external libraries. The framework provides form validation, object-relational mapper, open authentication system, upload mechanism and several other tool extensions.
  2. Django: This is a web development framework for Python. The framework provides a standard method for fast and effective website development. It can help you build and maintain high-quality web applications. It allows you to make the development process smooth and save time. This is an advanced web framework that can perform rapid development. The main goal of this web framework is to create complex database-driven websites.

Advantages of Django:-

  • Fast: Django is fast enough to code. Various libraries are provided, so you don’t need to reinvent the wheel or build the product from scratch. In addition, there is already a lot of pre-built code available for you to use in Django, which makes your job very easy.
  • Security: It has a wide range of security. It can prevent your website or application from most attacks, such as SQL Injection, XSS, CSRF, Clickjacking, etc.
  • Management Panel: It comes with a built-in management panel, which makes development easier and faster. Because you don’t have to create a separate management panel to handle the backend.

Advantages of the flask:

  • As a micro-framework that provides basic functions of web applications (such as URL routing or error handling), Flask is light and flexible. In this way, it is an extensible framework with a customizable structure.
  • Flask is a simple solution, and novice engineers find it easier to adapt, and experienced Python developers have more flexibility when adding features such as authentication or processing forms.
  • The above benefits mean that Flask is very suitable for small projects that need to start quickly.

Therefore, it is concluded that comparing all the above aspects, it is entirely up to the individual. For example, if you need to build our career in creating complex websites, you should choose Django, and if simplicity and flexibility are the keys to the transaction , Then you should definitely choose Flask. For web applications filled with static content or products that rely on a lot of microservices, this will be a good choice.

Answer 6 :

Both Django and Flask are very good Python web development frameworks. But when it comes to Django, it is highly versatile, which means you can develop any type of website, no matter the size. Flas is more like a lightweight framework, so it is suitable for smaller projects. Django has all the necessary tools needed to build a website, but when you use Flask, you will need to download third-party tools to provide full support for your project. Django follows the MVT (Model View Template) architecture and manages the task of creating websites well. In fact, you don’t need to create any initialization code, just like Django creates the initialization code directly for you.

You need to understand two situations. The first is whether you want to create small projects or have higher goals and create any kind of website. The second case is whether simplicity is your only goal.

In the first case, that is, if your goal is to create an excellent website that does not depend on size, the more suitable framework will be Django. For the second case, you can use Flask, the learning process of the two is different from each other.

Personally, I recommend using Django, because it is a full-featured universal tool that provides everything you need. Not only that, building a quality website with Django will never go wrong, because it is created in a way that guides you in the right way when creating a website. The most interesting point is that it is one of the most in-demand skills the industry needs with Python.

I suggest you start with Flask. With Flask, you will explicitly write your own route functions, make route presentation templates, etc., all of which use Python functions that you are already familiar with. There is almost no “magic”. You can see exactly how everything happened and understand why it happened. The Flask documentation is also very concise and clear, so you can read it and learn Flask in a few hours, spend a few nights learning how to make a complete application, and then continue to use Django. The time investment is small, it will provide you with a lot of preparation about Django, and you will learn about the excellent micro-framework. I sometimes create prototypes for projects in Flask and then build them in Django.

Although Django is more versatile, it has a clear structure and conventions, so for beginners, figuring out how everything fits may be more mysterious. If you are new to web development, you might be confused because it is a web development convention and you are doing something, or because it is part of a Django convention/organization.

If you can spend a few days or a week playing with Flask and then continue to learn Django (your original goal), I think it’s worth it. Both are good frameworks. Welcome to the field of web development.


Best Programming Language in 2020

Leave a Comment

Your email address will not be published.