当前位置:网站首页>Flask (II) - route
Flask (II) - route
2022-06-11 09:26:00 【zju_ cbw】
modern Web The framework uses routing technology to help users remember applications URL. Direct access to the desired page without navigating from the home page .
Flask Medium route() A decorator is used to decorate URL Bind to function . for example
from flask import Flask
app = Flask(__name__)
@app.route('/hello')
def hello_world():
return 'Hello World!!!'
if __name__ == '__main__':
app.run(debug = True)
here ,URL /hello Rules are bound to hello_world() function . therefore , If the user accesses URL : http://localhost:5000/hello , Will call hello_world() function , The result output of the execution in this function will be presented in the browser .
Application object add_url_rule() Function can also be used to URL Bind to function , As shown in the example above , Use route().
def hello_world():
return 'hello world'
app.add_url_rule('/hello', 'hello', hello_world)
边栏推荐
- Pytorch installation for getting started with deep learning
- Type-C蓝牙音箱单口可充可OTG方案
- MSF基于SMB的信息收集
- Sed explanation of shell script (SED command, sed -e, sed s/ new / old /...)
- Machine learning notes - in depth Learning Skills Checklist
- 考研數學 【數列極限證明題】題型方法總結
- 844. compare strings with backspace
- Machine learning notes - convolutional neural network memo list
- [software] ERP model selection method for large enterprises
- [ERP system] how much do you know about the professional and technical evaluation?
猜你喜欢

Strength and appearance Coexist -- an exclusive interview with Liu Yu, a member of Apache pulsar PMC

Use of MSF evaluation module

Openstack explanation (XXIII) -- other configurations, database initialization and service startup of neutron

Typescript -- preliminary study of variable declaration

Award winning survey streamnational sponsored 2022 Apache pulsar user questionnaire

MSF基于SMB的信息收集

MySQL:Got a packet bigger than ‘max_ allowed_ packet‘ bytes

Package details

Day39 process object and other method mutexes

Identifier keyword literal data type base conversion character encoding variable data type explanation operator
随机推荐
openstack详解(二十二)——Neutron插件配置
Video review pulsar summit Asia 2021, cases, operation and maintenance, ecological dry goods
Day45 storage engine data type integer floating point character type date type enumeration and set type constraints table to table relationships
[C language - function stack frame] analyze the whole process of function call from the perspective of disassembly
Do you know these advantages of ERP system?
[scheme development] scheme of infrared thermometer
考研數學 【數列極限證明題】題型方法總結
Type-C docking station adaptive power supply patent protection case
Automation operation and maintenance articles collection
小型制氧机解决方案PCBA电路板开发
OpenCV OAK-D-W广角相机测试
844. compare strings with backspace
Openstack explanation (22) -- neutron plug-in configuration
【芯片方案】红外人体测温仪方案设计
Day39 process object and other method mutexes
报错[error] input tesnor exceeds available data range [NeuralNetwork(3)] [error] Input tensor ‘0‘ (0)
Customize PCBA scheme and develop wrist sphygmomanometer scheme
[software] ERP model selection method for large enterprises
Set MySQL as externally connectable
DOS command virtual environment