首页 > 解决方案 > Gunicorn 不提供更新的 Flask 应用程序(带有 Flask 缓存)

问题描述

我有一个非常简单的 Flask 应用程序,它缓存了一个视图函数

app = Flask(__name__)
cache = Cache(app, config={'CACHE_TYPE': 'simple'})

@app.route("/")
@cache.cached(timeout=50)
def index():
    # code pulls data to put to index.html
    # ...

    return render_template('index.html')

我明确设置了 50 秒的超时,以便我可以检索新数据并更新index.html

我通过 Gunicorn 为我的应用程序提供服务,除了使用eventlet工作人员之外没有任何花哨的参数,但 Gunicorn 没有提供更新的index.html. 我也在nginxgunicorn前面,但我怀疑问题出在Gunicorn ...

标签: pythonnginxflaskgunicorn

解决方案


推荐阅读