Developers, especially newbies often get confused about choosing the framework to start learning.So this piece will help to have some clarity about it.
Selection of the framework is often guided by the requirements of the project that is undoubtful but, how should you start your learning if there are multiple choices (frameworks) to start with ?
Sometimes even multiple frameworks are used in the same project. This can get extremely confusing.
What should I start with?
Answer: It lies within their differences.
Differences:
Criteria | Django | Flask |
Database | Relational | Relational or non relational (Both) |
Contributors | Older therefore more contributors. | Enough contributors. |
Flexibility | Less flexible | More flexible(No conventions to follow ) |
Offerings | Dashboard, admin panel, user authentication, permissions, grouping(Access level control) | No offerings in fact. You can start wherever you like. |
Scalability | As it has rigid structure, there are some difficulties while scaling. | Fask offers open ended development, so you can easily scale it up. |
Security | Well established, secure framework | Simple and light weighted Micro framework. Security depends on your effort. |
Devil is in the detail so let’s elaborate more to have a clear picture.
Databases
If you are from a computer science background, you have for sure encountered relational databases’ ideas somewhere. If not also, you have a general understanding of tables and how data is stored and retrieved from tables. Since Django offers strong object relational mapping(ORM) and almost ignores non relational databases, we have head start here for Django. Instead of learning a non relational database , you can start with Django and rely on your existing knowledge of tables,relational databases and finally ORM.
Contributors
How on earth contributors affect my selection of framework?
Answer:It does. Number of contributors is directly proportional to number of problems encountered and number of problems ascribed.
Large number of contributors means there are lots of libraries to play with, and lots of problems that are solved and posted in different forums. So It is less likely that you will find a problem that is not solved yet. Almost all of your problems and their solution are already out there. Thank You stack overflow(<3)
Flexibility
Flexibility is something you would really love. No patterns, no structures, less rules to follow seems quite appealing. But are they good for developers who are new to the framework.?
Answer:Nope, Freedom to a new developer might result in chaos. Once you master the rules, pattern and structures, you will know why they were developed and how to use them and you can easily bend and break them to obtain your goal. Flask offers heightened flexibility, you do not have to follow any rules for settings, directory structure, url routing, views, templates and others in fact you can develop your own pattern. But there are less chances that you will follow a pattern and high chances of ending up with messy codes.
Offerings
With the offerings of django you do not have to worry about the redundant pattern and basic scaffold for most projects, they are already there. Dashboards, user authentications, access level controls, directory structures can be achieved with few configurations. You will be more than ready to just dive into coding once the django application is spawned. And once you get along with its patterns, you will have a clear understanding about them and can build your own pattern in other frameworks such as flask.These offering will just boost your understanding.
Scalability
To be honest, scalability is not a major concern for new developers, but it is a good practise to always think about how you can scale your project. Dev ops Engineers are responsible for scaling and there are various ways and tactics to scale up your project. Scaling in django is possible but tedious. But HEY! There is one in a million chance that your first project will need scaling. Scaling is usually done when your project expects more audience and existing architecture is not enough. So as a new developer you do not need to trouble yourself with scaling. Flask offers a great extent of scalability, but that is just a bonus, since you are bothering yourself with DeVOps job.
Security
Django is considered a secure and well established framework.You need to follow its protocols and best practises which will ensure security of your project. Flask on the other hand is a light weighted micro framework so you need to build your own security architecture for flask. And if you are not already a professional developer that might be troublesome.
So, let’s gather points from the above discussion to draw conclusions.Four points for django for
Databases,Contributors ,Offerings, security and two points for flask for Flexibility and Scalability. Voila
Conclusion
To sum up, it seems that it is good to start with Django if you are new to these frameworks and want to learn both. Personally, I made some effort while learning Django and after that flask was seamless. I cannot reckon efforts of learning flask. But again I am fond of both.