【发布时间】:2021-07-27 21:09:27
【问题描述】:
我要做的是检查启动事件的条件,如果发生执行,请不要启动服务器或停止服务器。
@app.on_event("startup")
def startup_event():
public_key = None
try:
with open(PUBLIC_KEY_FILE) as public_key_file:
public_key = public_key_file.read()
except Exception as f_error:
logger.exception(f_error)
# cancel the startup
有办法吗?
【问题讨论】: