当前位置:网站首页>Detailed explanation of flask framework
Detailed explanation of flask framework
2022-07-27 12:14:00 【Canghai light boat 690】
1、 First we import Flask class . Examples of this class will become our WSGI application .
2、 Then we create an instance of this class . The first parameter is the name of the application module or package . If you use The first mock exam ( Like this example ), Then you should use name , Because the name will be based on this Whether a module is used as an application or imported as a module changes ( May be ‘main’ , It could also be the name of the actual import ). This parameter is required , such Flask To know where to Find templates, static files, etc
3、 And then we use route() Decorator to tell Flask Trigger function URL .
4、 Function names are used to generate associated URL . The function finally returns the information that needs to be displayed in the user's browser .
rule The parameter represents the connection with the function URL binding .
options It's going to be forwarded to the foundation Rule Object's parameter list .
In the example above ,'/ ' URL And hello_world() Function binding . therefore , When opened in a browser web Server's home page , The output of the function is rendered .
Last ,Flask Class run() Method to run the application on the local development server .
All parameters are optional
host: The host name to listen on . The default is 127.0.0.1(localhost). Set to “0.0.0.0” To make the server available externally
port : The default value is 5000
debug: The default is false. If set to true, Provides debugging information , Can automatically reload code and display debug information
options: To forward to the bottom Werkzeug The server .
边栏推荐
- Shell脚本文本三剑客之awk
- NewTicker使用
- 银行人脸识别系统被攻破:一储户被偷走 43 万元
- torch‘ has no attribute ‘inference_ mode‘
- Detailed explanation of deeplab series (simple and practical annual summary)
- Firewall firewall
- 系统临时文件的写和读:createTempFile和tempFileContent[通俗易懂]
- Several rounds of SQL queries in a database
- 上半年火灾起数下降27.7%,广东将这样提升全民消防安全素质
- 查看系统下各个进程打开的文件描述符数量
猜你喜欢

广东:剧本杀等新行业新业态场所,消防安全监管不再“缺位”

NPM step pit

Multi activity disaster recovery construction after station B 713 accident | takintalks share
Do you really understand the underlying data structure skip list of Zset in redis?
![[untitled] multimodal model clip](/img/f0/8ae72ae0845372b6fe2866fae83f52.png)
[untitled] multimodal model clip
![[machine learning whiteboard derivation series] learning notes - support vector machine and principal component analysis](/img/54/dc232f737da99c7097c395a326e74f.png)
[machine learning whiteboard derivation series] learning notes - support vector machine and principal component analysis

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

SMA TE: Semi-Supervised Spatio-Temporal RepresentationLearning on Multivariate Time Series

Matlab draws Bode diagram with time delay system

Iptables firewall
随机推荐
Shake quickly to rescue the "frustrated person"
【机器学习-白板推导系列】学习笔记---支持向量机和主成分分析法
omitempty在go中的使用
Regular expression of shell programming (grep of shell script text three swordsmen)
Go Introduction (2)
Mysql8msi installation tutorial (database mysql installation tutorial)
USB network card drive data stream
Guangdong's finance has taken many measures to help stabilize the "ballast stone" of food security
Sword finger offer notes: T53 - ii Missing numbers from 0 to n-1
Sword finger offer notes: t57 - I. and two numbers of S
快抖抢救“失意人”
JS string method summary
JS-寄生组合式继承
Multi activity disaster recovery construction after station B 713 accident | takintalks share
Detailed explanation of deeplab series (simple and practical annual summary)
Go replace with local code
解决@OneToMany查询陷入循环引用问题
Sword finger offer notes: t58 - ii Rotate string left
象棋机器人「弄折了」棋童的手指。。。
mysql8msi安装教程(数据库mysql安装教程)