FlaskWeb开发-Hello World

app.route:程序实例提供的修饰器,把修饰的函数注册为路由。

路由:处理URL和函数之间关系的程序。

视图函数:像index()这样的函数称为视图函数。

app.run():启动服务器

默认服务器地址:http://127.0.0.1:5000/

 1 from flask import Flask
 2 
 3 app = Flask(__name__)
 4 
 5 
 6 @app.route('/')
 7 def index():
 8     return '<h1>Hello World!</h1>'
 9 
10 
11 if __name__ == '__main__':
12     app.run()

 如果想要使用https进行传输,可以加入参数ssl_context,如下设置地址为:https://localhost:9013

app.run(host='0.0.0.0', port=9013, ssl_context='adhoc')
原文地址:https://www.cnblogs.com/sammy1989/p/8695417.html