当前位置:网站首页>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
边栏推荐
- go语言之sync.Map
- Sword finger offer notes: T53 - ii Missing numbers from 0 to n-1
- 广东财政多举措助力稳住粮食安全“压舱石”
- deeplab系列详解(简单实用年度总结)
- Newton Raphson iterative method
- Temporary use of solo, difficult choice of Blog
- The chess robot "broke" the chess boy's finger...
- Do you really understand the underlying data structure skip list of Zset in redis?
- 严控室外作业时间!佛山住建局发文:加强高温期间建筑施工安全管理
- 微信小程序必用接口「建议收藏」
猜你喜欢

孤独的年轻人,戒不了Jellycat

Chapter 13 IO flow

The first case of monkeypox in pregnant women in the United States: the newborn was injected with immunoglobulin and was safely born

STS download tutorial (the solution cannot be downloaded on the include official website)
![[machine learning whiteboard derivation series] learning notes --- conditional random fields](/img/cc/87d8822b659b31360546adf057ef00.png)
[machine learning whiteboard derivation series] learning notes --- conditional random fields

I do live e-commerce in tiktok, UK

Could not load dynamic library ‘libcudnn.so.8‘;

Tlc549proteus simulation &sallen key filter &ad736vrms to DC conversion &proteus view 51 register value

SMA TE: Semi-Supervised Spatio-Temporal RepresentationLearning on Multivariate Time Series
Several rounds of SQL queries in a database
随机推荐
意外收获史诗级分布式资源,从基础到进阶都干货满满,大佬就是强!
Do you really understand the underlying data structure skip list of Zset in redis?
go 用本地代码replace
JS parasitic combinatorial inheritance
Regular expression of shell programming (grep of shell script text three swordsmen)
Shell脚本文本三剑客之awk
V-show failure
53 亿 BI 市场 TOP 10:帆软、微软、永洪、SAP、百度、IBM、SAS、思迈特、Salesforce、浪潮通软
kazoo使用教程
Leetcode 03: t58. Length of the last word (simple); Sword finger offer 05. replace spaces (simple); Sword finger offer 58 - ii Rotate string left (simple)
Chapter 7 exception handling
About offline caching application cache / using manifest file caching
Docker MySQL Usage Note
Several rounds of SQL queries in a database
源码编译安装LAMP
The difference between microcomputer and single chip microcomputer
Alibaba cloud RDS exception during pool initialization
Principle of PWM and generation of PWM wave
Solution: the idea project does not display a tree view
广东:剧本杀等新行业新业态场所,消防安全监管不再“缺位”