What Python web framework to choose - Django vs. Flask vs. JustPy

Web development is one of the things that Python does best, but you need to pick one of the the frameworks available for Python. You could also make web apps without using a web framework, but you would be reinventing the wheel. In this article you will learn how to choose the best web framework for the web app you want to build.

We are going to review the two most popular frameworks, Flask and Django, plus another very special framework, JustPy.

Django

PythonHow (this website) is built in Django. I chose Django over Flask because the website has many functionalities inside. It has a search engine for Python HowTo questions, a chatbot, video courses, interactive courses etc. All those functionalities are part of one Django project but each of them is a separate Django app inside that project. Django makes it easier to create big websites that have a different range of functionalities. Plus, Django makes it easier to create apps that have a database backend. For example, the HowTo questions of PythonHow are stored in a database and Django performs queries on that Database when users search for a HowTo question. There are also other databases tables in the Django project and each table is clearly represented by a Python class inside Django. That keeps things organized inside the project which is a big plus when it comes to big websites.

Flask

While Django is good for big websites, it could be overkill for small web apps. For example, if you just want to build a web app that converts Word documents to PDF, then Django would be too much work to set up. Flask would be more appropriate and it would take less time for such an app that does not have multiple functionalities.

JustPy

Building a web app in Django or Flask also requires that you have a certain knowledge of HTML since the frontend of the webpage that the user sees should be written in HTML. Django and Flask serve that HTML page to the user's browser. If you want the page to look modern, you also need some knowledge of CSS.  And if you also want to add interactive elements to the webpage frontend, you also need to know Javascript. Now, here is where JustPy comes in. JustPy is a web framework like Django and Flask, but it is also a wrapper around HTML, CSS, and Javascript. With JustPy you don't need to write a single line of HTML, CSS, and Javascript because the framework has its own objects (e.g., Div, H1, Button, etc.) which will render modern HTML webpages by writing Python code only. Again, I would say Django would be a winner when it comes to big websites because it makes database handling and general project maintenance easier, but if you just want to make a good looking small app, then JustPy could win over Flask, especially when you don't know HTML, CSS, and Javascript.

Conclusion

If you plan to become a web developer, you probably need to learn all three web frameworks mentioned above. The good news is if you learn one, the others are easier to learn. If you decide to learn them all, I would suggest to learn Flask first because Flask does things in a more low-level way so you might learn web development with Python from a deeper perspective. Then, you can learn Django and appreciate the level of abstraction that Django offers through its use of ORM (object-relational mapping) layer. And don't forget to have a look at JustPy as well as it is the most fun-to-build web framework among all.

Recommended Course

Python Mega Course: Learn Python in 60 Days, Build 20 Apps
Learn Python on Udemy completely in 60 days or less by building 20 real-world applications from web development to data science.