当前位置:网站首页>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 .
边栏推荐
- go入门篇 (2)
- Weibo comment crawler + visualization
- Interaction free shell programming
- Solve the problem of @onetomany query falling into circular reference
- Binary search decision tree (average search length of binary search tree)
- 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)
- 严控室外作业时间!佛山住建局发文:加强高温期间建筑施工安全管理
- Detailed explanation of deeplab series (simple and practical annual summary)
- Adobe audit prompts that the sampling rate of audio input does not match the output device - problem solving
- JS string method summary
猜你喜欢
![[untitled] multimodal model clip](/img/f0/8ae72ae0845372b6fe2866fae83f52.png)
[untitled] multimodal model clip

Solution of digital tube flash back after proteus8 professional version cracking

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

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

解决@OneToMany查询陷入循环引用问题

Image segmentation vs Adobe Photoshop (PS)

Regular expression of shell programming (grep of shell script text three swordsmen)

Adobe audit prompts that the sampling rate of audio input does not match the output device - problem solving

How to make a graph? Multiple subgraphs in a graph are histogram (or other graphs)

源码编译安装LAMP
随机推荐
STM32 compilation error: l6235e: more than one section matches selector - cannot all be first/l
Example of MATLAB dichotomy (example of finding zero point by dichotomy)
Introduction to box diagram
Go Beginner (4)
Leetcode 01: t1. sum of two numbers; T1108. IP address invalidation; T344. Reverse string
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)
Mysql8msi installation tutorial (database mysql installation tutorial)
Principle of control system based on feedback rate
Unity Shader 一 激光特效Shader[通俗易懂]
[machine learning whiteboard derivation series] learning notes - support vector machine and principal component analysis
5V升压9V芯片
Source code compilation and installation lamp
Detailed explanation of deeplab series (simple and practical annual summary)
Temporary use of solo, difficult choice of Blog
[untitled] multimodal model clip
Shell script text three swordsman awk
你尚未连接代理服务器可能有问题或地址不正确(如何查看代理服务器ip)
Multi activity disaster recovery construction after station B 713 accident | takintalks share
Image segmentation vs Adobe Photoshop (PS)
Go Introduction (2)