当前位置:网站首页>Detailed explanation of flask framework
Detailed explanation of flask framework
2022-07-27 12:16:00 【Canghai light boat 690】
python web Framework for understanding :
- django , Instead of , Heavy weapons .
Django: yes python The most widely used web One of the frames . There are very complete official documents , It provides a one-stop mature and reliable solution , Include cache ,ORM, Management backstage , Validation and form processing . Suitable for developing complex database driven websites . however , Because it provides a one-stop solution , The coupling degree of the system is high , It is not easy to replace the built-in functions , The learning curve is also relatively high .
There are many components inside :ORM、Admin、 middleware 、Form、ModelForm、Session、 cache 、 The signal 、 CRSF;
- flask, short , Expandable , Rich third-party components .
A lightweight customizable framework , Use Python Language writing , More flexible than other similar frameworks 、 Light 、 Safe and easy to use . It can be well combined with MVC Model for development , Developers work together , In a short time, small teams can complete small and medium-sized websites with rich functions or Web Implementation of services . in addition ,Flask And strong customization , Users can add corresponding functions according to their own needs , While keeping the core functions simple, it can enrich and expand the functions , Its powerful plug-in library allows users to achieve personalized website customization , Develop powerful websites .
- tornado, short + Asynchronous non-blocking
It is a non blocking web The server , This is a clear difference from other frameworks , And the speed is quite fast , Thousands of connections can be processed per second . but Tornado It provides the basic modules that the website needs to use , The rest needs to be extended by developers .
flask install : pip install flask
A complete program :
Quick display of web pages hello world:
from flask import Flask
# Configure the default : Take the directory where the current module is located as the root directory Static file directory (static) The template directory (templates)) ,
app = Flask(__name__)
# Bind the view function with the main path
@app.route('/index')
# Defined view function
def index():
return 'hello world'
if __name__ == "__main__":
# Simple test server
app.run()
function :
* Running on http://127.0.0.1:5000/ (Press CTRL+C to quit)
Then open this website : http://127.0.0.1:5000/ index
You can see that hello world
边栏推荐
- Docker MySQL Usage Note
- 解决方案:Can not issue executeUpdate() or executeLargeUpdate() for SELECTs
- [excerpt] [medical image] common DICOM thumbnail interpretation and viewer converter conversion tool
- Ali II: what if the AOF file in redis is too large?
- 快抖抢救“失意人”
- Chapter 10 enumeration classes and annotations
- Difference between verification and calibration
- How to make a graph? Multiple subgraphs in a graph are histogram (or other graphs)
- [machine learning whiteboard derivation series] learning notes --- conditional random fields
- The bank's face recognition system was broken: a depositor was stolen 430000 yuan
猜你喜欢

STS下载教程(include官网无法下载解决方案)

EfficientNet

Shake quickly to rescue the "frustrated person"

严控室外作业时间!佛山住建局发文:加强高温期间建筑施工安全管理

图像分割 vs Adobephotoshop(PS)

MySQL数据库主从复制集群原理概念以及搭建流程

go 用本地代码replace

Idea: can't use subversion command line client: SVN solution

Principle of PWM and generation of PWM wave

LNMP架构搭建(部署Discuz论坛)
随机推荐
MySQL数据库主从复制集群原理概念以及搭建流程
Detailed explanation of MATLAB S-function
JS parasitic combinatorial inheritance
Guangdong's finance has taken many measures to help stabilize the "ballast stone" of food security
[网摘][医学影像] 常用的DICOM缩略图解释以及Viewer converter 转换工具
STS download tutorial (the solution cannot be downloaded on the include official website)
STM32 compilation error: l6235e: more than one section matches selector - cannot all be first/l
omitempty在go中的使用
Why is ack=seq+1 when TCP shakes hands three times
Shell script text three swordsman awk
Chapter 10 enumeration classes and annotations
Newton Raphson iterative method
Shell脚本文本三剑客之awk
关于离线缓存Application Cache /使用 manifest文件缓存
广东:剧本杀等新行业新业态场所,消防安全监管不再“缺位”
shell中的while循环实例
Solution: the idea project does not display a tree view
One article to understand the index of like in MySQL
Check the number of file descriptors opened by each process under the system
Makefile template