Python


Redundant PostgreSQL connection in Django

Let’s assume you have a redundant cluster of PostgreSQL servers, eg built with repmgr, and you want your Django application to benefit from this redundancy. As of Django 3.1, this is not really documented, but some easy steps gets you there, if you are using recent versions of PostgreSQL, psycopg2, Django and Python. First of […]


Auto-vivification in Python 3.x

Are you spoiled by Perl’s auto-vivification allowing to write such code and you want to do the same in Python ? An often used, somewhat ugly code pattern where you need to add a key in a dict when it’s not there yet: There is a better way since Python 3.3 (even if Perl’s type […]