Jinja template Inheritance using Database

Jinja is a web template engine for the Python programming language. A Jinja template is simply a text file and can generate any text-based format (HTML, XML, CSV, LaTeX, etc.). A template contains variables and/or expressions, which get replaced with values when the template is rendered, thus serving dynamic content. Commonly, templates are stored as files, either in git-repo or s3 buckets. Depending on your use case, you can store the templates in the database as well.

Nix shell and Awesomeness: An Intro

Last year while working with @amitu, I came across this wonderful tool called Nix. I have been using Nix for almost all my projects now. I have written nix recipes for: rust, python, nodejs, elm, postgres, react, etc. About Nix, its wiki says: Nix is a package manager and build system that parses reproducible build instructions specified in the Nix Expression Language, a pure functional language with lazy evaluation

Django Middleware: log requests and responses

From Django’s context: Middleware is a framework of hooks into Django’s request/response processing. It’s a light, low-level “plugin” system for globally altering Django’s input or output. Middleware is like a layer which processes every request and response. Instead of logging requests and responses in resp. views, its better to do at middleware layer which will log every incoming request. Why better? it will log unhandled requests/views one time job, no need to configure for every request/view Here, we are using Django’s middleware semantics to construct a middleware which will log all requests and corresponding responses.

Save the production with nginx

Quick nginx hack to save your production web server in case the web service starts crashing. If you have been working in a production environment, you know at certain times your web service can crash due to some unknown reason (code failure). It will take some time to do the RCA and fix the issue. A quick hack is to have multiple web services running on different ports resp. that can take the load off if any of them goes down.