Flask framework-introduction

Introduction to Flask:

Flask was born in 2010 and is a lightweight web development framework written in Python based on the Werkzeug toolbox.

Flask itself is equivalent to a kernel, and almost all other functions need to be extended (mail extension Flask-Mail, user authentication Flask-Login), and all need to be implemented with third-party extensions.

Its WSGI toolbox uses Werkzeug (routing module), and its template engine uses Jinja2. These two are also the core of the Flask framework.

Python's most famous framework is Django, in addition to Flask, Tornado and other frameworks. Although Flask is not the most famous framework, Flask should be regarded as one of the most flexible frameworks, which is why Flask is popular among developers.

Flask commonly used extension packages:

  • Flask-SQLalchemy: operating database;

  • Flask-migrate: manage the migration database;

  • Flask-Mail: mail;

  • Flask-WTF: form;

  • Flask-Bable: provide internationalization and localization support, translation;

  • Flask-script: insert script;

  • Flask-Login: authenticated user status;

  • Flask-OpenID: authentication;

  • Flask-RESTful: a tool for developing REST API;

  • Flask-Bootstrap: integrated front-end Twitter Bootstrap framework;

  • Flask-Moment: localization date and time;

  • Flask-Admin: a simple and extensible management interface framework

    1. Chinese documents (http://docs.jinkan.org/docs/flask/)
    2. English documents (http://flask.pocoo.org/docs/0.12/)

Flask vs. Django

Django
Insert picture description here
Flask
Insert picture description here

The difference between the frames

  • Django is large and complete, Flask only includes basic configuration
  • Django's one-stop solution allows developers to avoid spending a lot of time on selecting application infrastructure before development. Django has built-in functions such as templates, forms, routing, authentication, and basic database management. In contrast, Flask is just a core, relying on two external libraries by default: Jinja2 template engine and Werkzeug WSGI toolset. Many other functions are embedded and used in an extended form.
  • Flask is more flexible than Django
  • Flask was released after Django. At this stage, there are a large number of plugins and extensions to meet different needs.
    Django was released in 2005 and Flask was founded in mid-2010.

Guess you like

Origin blog.csdn.net/weixin_46237597/article/details/113448391