Flask--读取参数

from flask import Flask

app=Flask(__name__)
	
class Config(object):
	DEBUG=True
	PI=3.14

app.config.from_object(Config)

@app.route('/')
def index():
	ret=app.config.get('PI')  #获取常量
	print(ret)

	return 'index...'

if __name__ == '__main__':
	#修改端口号
	app.run(port=8000,debug=True)

猜你喜欢

转载自blog.csdn.net/weixin_44111377/article/details/92000846