python - flask + gunicorn数据查询问题
PHP中文网
PHP中文网 2017-04-18 09:53:10
0
2
301

flask + gunicorn运行程序,在数据库中手动insert数据后,需要重启gunicorn,flask程序才能查到新数据。

PHP中文网
PHP中文网

认证高级PHP讲师

reply all(2)
PHPzhong

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()
Peter_Zhu

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.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!