載入常量-從檔案中載入

yongheng999發表於2024-07-17

配置檔案:

程式碼:

from flask import Flask





app=Flask(__name__)
app.config.from_pyfile('setting.py')



@app.route('/')
def index():
print(app.config['USER'])
print(app.config['PWD'])
return "Hello World!"


if __name__ == '__main__':
app.run()

相關文章