Skip to content

2023

Sharing data in a Flask App accross Gunicorn Workers

I have a flask app, I wanted to deploy it to so I configured NGinx proxy and I was already using Cloudflare. Thus the app started running behind 2 proxy servers. Until this point I was not using flask sessions to keep data so everyhting was running fine. You could ask how flask sessions was a problem. Well the feature is not the problem but my naive setting the SECRET_KEY was.

import secrets
SECRET_KEY = secrets.token_hex(32)