Comparing Python Frameworks
credit: unplush

Comparing Python Frameworks

Flask

Flask is very performant. 

Very flexible and doesn't require users to use any particular project or code layout.

Flask is simple and its core features are not difficult to learn. 

Flask doesn't come with a built-in ORM framework. Developers can use one of many open source libraries or extensions. Such as Flask-SQLAlchemy, Flask-Pony, etc.

Ships with SQLAlchemy with Master Slave load Balancing.

No built-in admin panel, but you can use the Flask-Admin extension.

Supported via extensions such as Flask-RESTful, Flask-Classful, Flask-RESTPlus.

Despite being a minimalist Framework, Flask does an excellent job of addressing common security concerns like CSRF, XSS, JSON security and more out of the box. 3rd party extensions like Flask-Security can be used for common security measures.

Little built-in protection. Must be handled by developers themselves or by using 3rd party extensions.

Flask uses Jinja2 out of the box.

No built-in support but there is a Flask-WTF extension. For SQLAlchemy support, that is, to create forms based on models, there is WTForms-Alchemy

Only provides support for cookie-based sessions but there are extensions available for authentication, authorization and account management.

Built-in support using Python's unit test framework.

https://flask.palletsprojects.com/en/1.0.x/quickstart/

------------------------------------------------------------------------------------------------------------

Django

Not as performance as barebones or even full stack frameworks. Extensions could impact performance adversely.

Django expects things to be done in a certain way unlike microframeworks (e.g. Flask) which have no opinion on how developers structure things. However, It does this without compromising on flexibility. 

Has a learning curve especially for those who are not familiar with other web frameworks.

Django ships with a built-in ORM framework for developers to start using out of the box.

NoSQL databases are supported through open source libraries or extensions. To use MongoDB with Flask, Flask-PyMong is a popular choice. CouchDB, Cassandra, and DynamoDB are also supported via libraries.

NoSQL databases are not officially supported by Django. There are open source projects like PynamoDB or Django MongoDB Engine, Django non-rel to support NoSQL.

Django ships with a web-based admin site that has a friendly UI. 

While not built-in, REST development is supported via the popular and active Django REST Framework project.

Built-in protection against several common attack vectors like CSRF, XSS, and SQL injection. 

Uses its own templating engine.

Ships with built-in ModelForms which provides complete support for web forms including input validation, CSRF, XSS, and SQL injection.

Built-in authentication, authorization, account management and support for sessions.

Built-in support using Python's unittest framework.

https://www.djangoproject.com/start/

----------------------------------------------------------------------------------------------------------

TurboGeaers

Not as performance as barebones or even full stack frameworks. Extensions could impact performance adversely.

Developers can use TurboGears as a microframework which is very flexible. However, as you start building towards a full stack solution, it does expect things to be done in a certain way.

It has a learning, but since it uses many existing 3rd party libraries, it becomes a little easier to onboard.

Supports MongoDB out of the box using Ming ORM. Ming ORM was developed to look like SQLAlchemy so it's easier for developers familiar with SQLAlchemy to start using it.

Built-in admin panel.

Built-in support using tg.controllers.RestController. 

Ships with internally developed Kajiki templating engine, but supports multiple templating engines including Genshi.

TurboGears relies on ToscaWidgets2 for building and validating forms.

Ships with repoze.who which is an authentication and identity framework for WSGI applications.

Using Nose.

https://turbogears.readthedocs.io/en/tg2.3.12/

--------------------------------------------------------------------------------------------------------

A developer already experienced with Django or Flask can take any other framework easily. Turbogears are mostly used for full stack application development. However, any framework can be used as a back-end framework easily, removing the templating part and using REST framework.


要查看或添加评论,请登录

Dhiraj Patra的更多文章

  • GAN, Stable Diffusion, GPT, Multi Modal Concept

    GAN, Stable Diffusion, GPT, Multi Modal Concept

    In recent years, advancements in artificial intelligence (AI) and machine learning (ML) have revolutionized how we…

  • Forced Labour of Mobile Industry

    Forced Labour of Mobile Industry

    Today I want to discuss a deeply troubling and complex issue involving the mining of minerals used in electronics…

  • NVIDIA DGX Spark: A Detailed Report on Specifications

    NVIDIA DGX Spark: A Detailed Report on Specifications

    nvidia NVIDIA DGX Spark: A Detailed Report on Specifications The NVIDIA DGX Spark represents a significant leap in…

  • Future Career Options in Emerging & High-growth Technologies

    Future Career Options in Emerging & High-growth Technologies

    1. Artificial Intelligence & Machine Learning Generative AI (LLMs, AI copilots, AI automation) AI for cybersecurity and…

  • Construction Pollution in India: A Silent Killer of Lungs and Lives

    Construction Pollution in India: A Silent Killer of Lungs and Lives

    Construction Pollution in India: A Silent Killer of Lungs and Lives India is witnessing rapid urbanization, with…

  • COBOT with GenAI and Federated Learning

    COBOT with GenAI and Federated Learning

    The integration of Generative AI (GenAI) and Large Language Models (LLMs) is poised to significantly enhance the…

  • Robotics Study Guide

    Robotics Study Guide

    image credit wikimedia Here is a comprehensive study guide for robotics covering the topics you mentioned: Linux for…

  • Some Handy Git Use Cases

    Some Handy Git Use Cases

    Let's dive deeper into Git commands, especially those that are more advanced and relate to your workflow. Understanding…

  • Kafka with KRaft (Kafka Raft)

    Kafka with KRaft (Kafka Raft)

    Kafka and KRaft (Kafka Raft) Explained with Examples 1. What is Kafka? Kafka is a distributed event streaming platform…

  • Conversational AI Agent for SME Executive

    Conversational AI Agent for SME Executive

    Use Case: Consider Management Consulting companies like McKinsey, PwC or BCG. They consult with large scale enterprises…

社区洞察

其他会员也浏览了