RSSAmplifier

Blog

MyBlueLinux.com

Recent content on MyBlueLinux.com

mybluelinux.comRSS feed ↗254 posts

Latest posts

Python SocketServer Guide

The socketserver module (formerly capitalized as SocketServer in Python 2) is a framework in the Python standard library designed to simplify the task of writing network servers. It abstracts away much of the boilerplate code required to set up sockets, bind to addresses, listen for incoming connections, and handle requests. 
 At its core, socketserver decouples the server-level transport…

Mastering Sorting in Python: From Basics to Advanced

Here is a comprehensive article on sorting iterables in Python, moving from the basics to advanced, custom techniques.

How to Loop Through Nested Dictionaries in Django Templates

Here is a article describing the general steps for iterating through nested dictionaries in Django templates.

Idempotency - Theory and Practice

In the grand lexicon of intimidating computer science jargon, the word “ idempotent ” sits comfortably near the top. By the end of this article, you won’t just know what idempotency is ; you’ll understand why it is one of the most important principles for building trustworthy software .

Why Your Queue Processes the Same Job Twice

At-least-once vs exactly-once delivery, and why “exactly-once” is a myth people keep selling you

Idempotency Explained Simply

Why “click Pay twice, charged once” is so much harder than it looks

Database Design Patterns Every Python Backend Needs in Production

Your database models define your data. Your patterns define whether you can trust it.

Django Testing Strategies with Examples

Django Testing Strategies with Examples. From Unit Tests to End-to-End

Python Descriptors Guide

Python Descriptors - The Secret Weapon That Power Frameworks Like Django and SQLAlchemy

Playwright Tricks That Saved Me Hours of Web Automation Pain

Today, I’ll share Python Playwright tricks that saved me hours . These aren’t generic tips. These are battle-tested, learned-the-hard-way, “oh-that’s-why-my-script-kept-breaking” insights that every Python developer should know.

Django Under Hood 10: Django’s Test Client - How Your Tests Fake HTTP Requests

The test client is a simulation — a carefully crafted fake that mimics HTTP requests while staying entirely in-process. It’s fast. It’s convenient. And it’s subtly different from real requests in ways that can make tests pass while production fails. Let’s trace what happens when you call self.client.get()

Django Under Hood 09: Django’s Migration System - From Model Changes to ALTER TABLE

How does Django know what changed in sql database? Let’s trace from makemigrations to ALTER TABLE .

Django Under Hood 08: Django’s Static Files - From collectstatic to Browser Cache

Let’s trace a static file from your static/ directory to a browser's cache... Most Django applications have misconfigured static files. They work, but they’re slow, or they break on deploy, or they don’t cache properly. Understanding the staticfiles system prevents these issues.

Django Under Hood 07: Django’s Authentication Backend Chain - How Users Actually Get Authenticated

Understanding the authentication chain isn’t about adding features — it’s about debugging the ones that mysteriously don’t work. Let’s trace from authenticate() to request.user .

Django Under Hood 06: Django’s Form Pipeline - From POST Data to Validated Python Objects

Between request.POST and a saved database record, Django executes a precise sequence of operations: binding data, coercing types, running validators, checking constraints, cleaning fields, and cross-field validation. Let’s trace a form submission from raw POST bytes to validated Python objects.

Django Under Hood 05: Django’s Template Engine - From HTML to Python Bytecode

Understanding the template engine isn’t about optimization tricks. It’s about seeing templates for what they are: compiled programs with real performance characteristics. Let’s trace a template from source text to rendered output.

Django Under Hood 04: Django’s Signal Dispatch — The Observer Pattern You’re Using Wrong

Understanding signal internals isn’t academic. It’s the difference between code that works reliably and code that fails mysteriously in production. Let’s look inside.

Django Under Hood 03: Django’s Connection Management — What Happens Between Your Code and PostgreSQL

Every sql query needs a database connection in django. But you didn’t open one. You won’t close one. Django handles it. But How?

Django Under Hood 02: Django’s ORM Query Compiler—From QuerySet to SQL

The laziest code in your application: Django’s ORM is lazy. Aggressively lazy. It builds a query specification, passes it through a compiler, generates SQL, and executes it — but only when absolutely necessary.

Django Under Hood 01: Django Request/Response lifecycle - What Actually Happens When a Request Hits Your Server

What happens in the 47 milliseconds between a request arriving at your server and your view function executing? What code runs? What objects are created? What decisions are made before you even see the request?

Mastering Django GeneratedField with examples

Learn how to use Django's GeneratedField to enhance your models efficiently. Discover its benefits, implementation, and best practices to optimize database performance in Django.

Django select_related vs prefetch_related: The Visual Guide

I realized I'd never actually seen anyone explain the django select_related and prefetch_related difference visually - showing what SQL each one produces, what data flows where, and why picking the wrong one doesn't just fail to help but can actually make things worse. So I drew it on a whiteboard. That whiteboard sketch eventually became this article.

Django Custom User Model: The Right Way From Day One

Every Django project should start with a custom user model. Not because you need custom fields right now, but because you will. And by the time you do, switching is either a 15-minute task (if you did it on day one) or a multi-day nightmare (if you didn’t). Skip this step and you’ll regret it by migration 20.

Best HTML5 Features

Let me show you the HTML5 features that speed up loading and completely changed how I build web.

Incredible Python Code Snippets

These are low-level, sharp-edged utilities I actually reach for when building real systems, debugging production issues, or automating things that shouldn’t need a full framework. Every function below exists because it solved a problem I hit more than once.

Best Django HTMX Snippets

Here are my best django + htmx snippets

PostgreSQL Connection Pooling: Django Native Pools and PgBouncer

Optimizing the Most Critical Connection in Your Stack

Database Indexing: The Performance Trick Nobody Explained Properly

Your queries are slow because you don’t understand indexes. Let’s fix that in 15 minutes.

Django Authentication & Authorization

The Security Foundation Every Django App Needs—Done Right from Day One

Django Caching Strategies

A few years ago, I watched a Django application handle 10x its normal traffic during a product launch. The secret? Aggressive caching.

Stop Trusting Your Reverse Proxy: Secure Django the Right Way

Ready to take your Django app beyond development? Learn how to securely deploy your Django web app in production over HTTPS with reverse proxy like Nginx. Along the way, you'll explore how HTTP headers can fortify your app's security.

Django select_related and prefetch_related Complete Guide

This article will reveal advanced techniques for optimizing database queries, specifically on Django, and their impact on query performance.

Django: Change User Model

Django’s documentation says it clearly but most people miss it: “If you’re starting a new project, it’s highly recommended to set up a custom user model, even if the default User model is sufficient for you.”

Django’s select_related Didn’t Fix My N+1 Queries

Wrong optimization makes queries worse

Django’s @atomic Decorator Didn’t Prevent My Race Condition

The insane reality where wrapping everything in @transaction.atomic still allows two users to book the same seat, and “all or nothing” doesn’t mean “one at a time.”

How show raw SQL queries for your django queries or querysets

Django ORM makes querying the database easier. But how to know what is happening behind the scenes or what SQL query is executed for certain django query. Here are some ways that might be useful to know that.

Django Signals: The Complete Guide

Django signals are one of the framework’s most powerful yet underutilized features. They allow decoupled applications to get notified when certain actions occur elsewhere in the framework, enabling you to build more maintainable, scalable, and responsive applications. In this comprehensive guide, we’ll explore every Django signal, complete with real-world use cases and optimization strategies.

Python Libraries That Shocked Me With Their Power

Here are Python libraries that made me stop, scratch my head, and then quietly add them to my permanent toolkit.

Async vs Defer in JavaScript: Which is Better?🤔

This article will explore an interesting Javascript topic. async and defer are attributes used when including external JavaScript files in HTML documents. They affect how the browser loads and executes the script. Let's learn about them in detail.

Normalizing Line Endings in Git: CRLF vs. LF

Git wants to save in LF. The world wants to save in LF. Linux and Mac have the default of LF. Windows is alone in having CRLF. So the decision is made: LF. You can manage and replace LF with CRLF in your Git repository, ensuring consistent line endings according to your project requirements.

Gunicorn, Uvicorn, and uWSGI Tested: Which WSGI Server Leads in Speed?

We conducted all tests locally to eliminate variables such as CPU or memory shortages that could skew the results. Our focus was on various configurations of Gunicorn and Uvicorn, as well as uWSGI, to examine their capability to handle different loads.

Django Middleware - Comprehensive Guide

In Python Django, middleware is a framework that provides a method to process requests and responses globally before they are processed by the view or after they leave the view. Middleware components are designed so that they remain between the web server and the view, allowing us to perform various operations on requests and responses as they pass through the Django application and web browser.

How to Fix TypeError: 'str' Object Is Not Callable in Python

TypeError: 'str' object is not callable occurs when an string value is called as a function and can be solved by renaming the str value. Here’s how.

How Kubernetes Reinvented Virtual Machines

There are lots of posts trying to show how simple it is to get started with Kubernetes. But many of these posts use complicated Kubernetes jargon for that, so even those with some prior server-side knowledge might be bewildered. Let me try something different here.

My Python's Ultimate Secrets

Hidden Gems and Lesser-Known Techniques That Transformed My Python Coding Journey

SPF macros explained

Learn everything you need to know about SPF macros to take better control over your SPF records. And one example how resolve spf macro with dns queries.

Test abd Debug SPF with command line

How to troubleshoot postfix-policyd-spf-python?

Monitor PostgreSQL Database Performance

Simple parameters to check for optimal performance and reliability

PAGINATION IN DJANGO In 15 Minutes

Spreading out your content over several pages as opposed to presenting it all at once would greatly enhance the user experience of your Django web project. Pagination is the term for this method. 
 Instead of dumping all the data on the user at once, you can specify how many records should be presented per page and then give back the data that matches the page that the user requested. 
…

The Best Django Extensions and Plugins

Dive into the powerful but intricate world of Django extensions. Learn to navigate database flexibility, manage complexity & ensure security. Explore real-world use cases & solutions for advanced projects. Unlock the full potential of your tech stack. Let’s innovate together.