当前位置:网站首页>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
边栏推荐
- 二分查找判定树(二分查找树平均查找长度)
- Lonely young people can't quit jellycat
- go入门篇 (2)
- Write and read system temporary files: createtempfile and tempfilecontent[easy to understand]
- Principle, concept and construction process of MySQL database master-slave replication cluster
- Kazoo tutorial
- shell编程之免交互
- CLS monitoring alarm: ensure high availability of online services in real time
- JS string method summary
- Matlab draws Bode diagram with time delay system
猜你喜欢

我在英国TikTok做直播电商

快抖抢救“失意人”

Matlab draws Bode diagram with time delay system

Strictly control outdoor operation time! Foshan housing and Urban Rural Development Bureau issued a document: strengthening construction safety management during high temperature

Solution of digital tube flash back after proteus8 professional version cracking
Ali II: what if the AOF file in redis is too large?

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

Chapter 10 enumeration classes and annotations

Shell script text three swordsman awk

Beyond compare 3 next difference segment / down search arrow not found
随机推荐
Regular expression of shell programming (grep of shell script text three swordsmen)
B 站 713 事故后的多活容灾建设|TakinTalks 大咖分享
Shell script text three swordsmen sed
shell中的while循环实例
Difference between verification and calibration
二分查找判定树(二分查找树平均查找长度)
go入门篇 (4)
Guangdong's finance has taken many measures to help stabilize the "ballast stone" of food security
Sword finger offer notes: t57 - I. and two numbers of S
Why is ack=seq+1 when TCP shakes hands three times
go语言之sync.Map
NewTicker使用
查看系统下各个进程打开的文件描述符数量
Leetcode 02: sword finger offer 58 - I. flip the word order (simple); T123. Verify palindrome string; T9. Palindromes
Plus版SBOM:流水线物料清单PBOM
kazoo使用教程
shell编程之免交互
JS string method summary
JS parasitic combinatorial inheritance
Introduction to box diagram