您好,我正在开发Web应用程序。
我用烧瓶和金枪鱼来运行Web应用程序。
我怎么了?
代码前
class A():
def __init__():
self.dict = {}
self.load_data()
def handle_req(self, params):
#process
def load_data():
self.dict = large data
flask_app = Flask(__name__)
@flask_app.route("/"):
def handle():
param = request.get("param")
a.handle_req(param)
if "__main__"==__name__:
a = A()
GunicornServer(flask_app).run()
代码后:
class A():
def __init__():
self.dict = {}
self.load_data()
self.handle_req("test") #<<-- added
def handle_req(self, params):
#process
def load_data():
self.dict = large data
flask_app = Flask(__name__)
@flask_app.route("/"):
def handle():
param = request.get("param")
a.handle_req(param)
if "__main__"==__name__:
a = A()
GunicornServer(flask_app).run()