3.1 应用、蓝图与视图函数
Last updated
Was this helpful?
Last updated
Was this helpful?
Was this helpful?
# app/__init__.py
from flask import Flask
def create_app():
app = Flask(__name__)
app.config.from_object("config")
return appfrom app import create_app
app = create_app()
if __name__ == "__main__":
print("id为" + str(id(app)) + "的app启动")
app.run(host=app.config["HOST"], debug=app.config["DEBUG"], port=app.config["PORT"])