Python Gunicorn不提供更新的烧瓶应用程序(带烧瓶缓存)

Python Gunicorn不提供更新的烧瓶应用程序(带烧瓶缓存),python,nginx,flask,gunicorn,Python,Nginx,Flask,Gunicorn,我有一个非常简单的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.ht

我有一个非常简单的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


除了使用
eventlet
worker之外,我通过Gunicorn为我的应用程序提供服务,没有任何花哨的参数,但是Gunicorn没有提供更新的
index.html
。我还有
nginx
在gunicorn前面,但我怀疑问题出在gunicorn…

分别更新
index.html
的原因是什么?难道你不能在view函数中计算动态数据,然后像
render\u template('index.html',someVar=dynamic\u info)
多少gunicorn工人一样传递给模板吗?这些缓存超时适用于每个工作者。@v25,我正在用python更新
index.html
,因为我正在使用plotly dash,它是一个可视化库。我可以将数据传递给模板并使用
d3.js
,但如果可能的话,我不希望这样做。未编译的Jinija2模板不应该在应用程序运行时更新@你看过吗?这有许多关于dash应用程序应该如何与Flask集成的示例。@pairwiseseq这取决于它@v25的评论值得首先回答。您是否正在更改
index.html
模板本身(这会使您遇到不同的缓存机制),或者更改提供给
index.html
呈现的值?如果是后者,则可能需要重新考虑缓存和缓存超时假设。