Flask framework web development introduction

Why use a web framework? Because avoid repeating the wheel!

The web server side adopts a mature and robust framework.

Flask was born in 2010. Flask itself is equivalent to a kernel, and almost all other functions need to be extended.

By default, it relies on two external libraries: the jinjia2 template engine and the werkzeug WSGI toolset.

 

flask installation environment

Install flask using a virtual environment to avoid package confusion and version conflicts. A virtual environment is a copy of the python interpreter,

In the virtual environment, you can use the installation extension package. The virtual environment created separately for each program can ensure that the program can only access the packages of the virtual environment.

It will not affect the global python interpreter installed in the system, thus ensuring the cleanliness of the global interpreter.

 

The virtual environment is created using virtualenv. You can check whether the system has virtualenv installed:

virtualenv --version

Install the virtual environment:

sudo pip install virtualenv

sudo pip install virtualenvwrapper

Create a virtual environment (need to be online):

mkcirtualenv Flask_py

 

Enter the virtual environment to install flask:

pip install flask

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325273229&siteId=291194637