flask + gunicorn运行程序,在数据库中手动insert数据后,需要重启gunicorn,flask程序才能查到新数据。
PHPz2017-04-18 09:55:10
You need to disconnect the database before and after the request or after the request
@app.teardown_request
def shutdown_session(exception=None):
app.logger.debug('remove session')
db_session.remove()
天蓬老师2017-04-18 09:55:10
This problem should not be a problem of gunicorn not restarting. It should be a cache issue. The data in the database has changed, but flask still stores the previous data in the memory. It may be caused by you not reloading the data. I don't know exactly how you use it. That's all I can say.