Blog


Flask globals – request context – application context – session

I have come to Flask from Django and in this post I am writing down my thoughts as I get more comfortable with Flask globals. Request and Application Context from flask import request, current_app, g request context In that simple line, we have imported three global objects. One is the request object and other two […]




Python Poetry – dependency manager plus packaging tool

I was hearing about this awesome new kid on the block called Poetry. I had taken a look on it in the past (approx two years ago) and it looked not as finished as pipenv, so had stuck with pipenv + setup.py. But over the weekend, I decided to take another look at it after […]




Secret Key generation for Django and Flask

Both Django and Flask rely on SECRET_KEY to generate things like session IDs, cookies etc. Here is a safe way to generate them. Note that this relies on the secrets module introduced in Python 3.6 and onwards. From the Python docs: The secrets module is used for generating cryptographically strong random numbers suitable for managing […]