Framework: Django vs Flask vs FastAPI

이다연·2021년 5월 28일
0

https://www.section.io/engineering-education/choosing-between-django-flask-and-fastapi/

Pros, cons and use cases

Django

Pros

This is called Django Rest Framework (DRF).

  • The Rest framework (Representational state transfer can be defined as a software architectural style that defines a set of constraints to be used when creating web services) in Django.

  • Django emphasizes security by providing defense against joint SQL injection and cross-site request forgery attacks.

Cons

  • Django Models can have no mixins, they just have simple inheritance.

  • Django uses ORM, which was created before SQLAlchemy, making Django ORM inferior to SQLAlchemy because it is less flexible.

Flask

Pros

  • Flask is flexible and comfortable. Most parts of Flask have the possibility of changing, which is very unlikely for some other web frameworks.

Cons

  • Flask uses Modules, which is a third-party involvement and is prone to cause security breaches.

It’s not advisable to use it for high-load enterprise software.

FastAPI

Pros

  • Fast API validates the developer’s data type even in deeply nested JSON requests.
  • Fast API is built on standards like JSON Schema (a tool used for validating the structure of JSON data), OAuth 2.0 (it’s the industry-standard protocol for authorization), and OpenAPI (which is a publicly available application programming interface)
  • FastAPI makes it easy to build a GraphQL API with a Python library called graphene-python.

Cons

  • Because FastAPI is relatively new, the community is small compared to other frameworks, and regardless of its detailed documentation, there is very little external educational materials.

FastAPI Use cases

Fast API, works perfectly if your concern is speed. Netflix uses it for its internal crisis management.
It also scales perfectly in deploying production-ready machine learning models because ML models work best in production when they are wrapped around a REST API and deployed in a microservice.

profile
Dayeon Lee | Django & Python Web Developer

0개의 댓글