RSSAmplifier

Blog

Anže's Blog

Recent content on Anže's Blog

blog.pecar.meRSS feed ↗50 posts

Latest posts

The 15-Year-Old iptables Rule That Broke My DNS

One of my servers has a weird problem after every reboot: it can ping IP addresses just fine, but it can’t resolve any DNS names. $ ping 8.8.8.8 # works $ ping google.com # ping: google.com: Temporary failure in name resolution I’ve been working around this for a while now: after every reboot I’d SSH in and overwrite /etc/resolv.conf to point straight at 8.8.8.8 instead of the…

Fedidevs 9h Outage Postmortem

Today I had almost 9 hours of downtime on fedidevs.com and some of my other sites that I run on a Raspberry Pi at home. The alert came in just as I was heading to bed and I didn’t see it until I woke up this morning 🫣 Since Jake on Mastodon asked for a Cloudflare-style postmortem, here it is: Incident report: ~9h loss of upstream connectivity on the raspberrypi host Date: 2026-05-12 /…

Letting Claude Upgrade My Raspberry Pi

I have two Raspberry Pis at home. One hosts my various sites including fedidevs.com and the other supports it by storing backups of all the configs and data. This includes a streaming hot standby of the Postgres database that powers some of my sites. I am not (yet) brave enough to run Claude on my primary Pi, but I decided to let it loose on my secondary. Doing an in-place dist upgrade on a…

Agents Day Lisbon

Last week I attended the Agents Day Hackathon in Lisbon. It was a full day of talks, socializing, and building agents. Talks There were a few talks and a round table discussion during the hackathon. The most memorable one for me was about the challenges behind Cloudflare’s 16 MCP servers. All 2500+ Cloudflare endpoints couldn’t fit into a single MCP server, since listing them all used…

DjangoCon Europe 2026

Before the conference My partner and I arrived in Athens a few days before the conference. It was a convenient excuse to visit a European capital we hadn’t been to yet, and of course to eat as much delicious food as possible. Django Social One day before the conference I went to the django.social event organized by Jon Gould and Andrew Miller . The bar they initially picked got too crowded,…

How to Safely Update Your Dependencies

With all the supply chain attacks happening lately ( litellm being the most recent example) keeping dependencies up to date without risk has been on my mind. Below is everything I do to keep my personal projects secure, what we do at Fencer to keep our own codebase secure, and what we recommend to the startups we work with. Be hesitant about what you add The best way to reduce the risk of…

Speeding Up Django Startup Times with Lazy Imports

At Fancer we are building the security suite for startups. Startups use a lot of SaaS tools and services which means we are building a lot of integrations. Most of these go through API calls but we also try to leverage SDKs to make our lives a little bit easier. The problem we started noticing was that loading all these 3rd party integrations has made our Django app feel very sluggish. While this…

Typing Your Django Project in 2026

The first version of Django was released about 10 years before Python standardized its type hints syntax . Because of this it’s not surprising that getting type hints to work in your Django project is not going to be trivial. django-stubs with mypy If you want your Django codebase to be type checked then django-stubs is the go to package to use. It ships both type-stubs for most of…

Claude Fixes User Bug

I received this bug report in a toot from a Fedidevs user: Dear @fedidevs I think there is a bug with the starterpacks: When in “Add accounts” I search for an account that is already in the Pack, the tick-box can show empty. When I click it, it will switch to ticked, but the account is actually removed from the pack. This is also confirmed by the number of accounts in the pack going…

Jekyll to Hugo Migration

In my last post I mentioned that software engineering is going to be more and more AI driven and since then I’ve begrudgingly accepted this new reality. The era of handcrafted code is mostly coming to an end. I say mostly because I still believe there will always be places in our future codebases that require manual intervention. Little surgical removals and additions around the parts where…

Advent of Code 2025 🎄

December is the time for Advent of Code, as it has been since 2015, when the first Advent of Code event was published. This year, Advent of Code only had 12 days instead of the usual 25. To me, this was a relief. I always get competitive and then start waking up at 5 am every day to get more points on the leaderboards. I did the exact same thing this year as well, of course, but at least I only…

Django bulk_update Memory Issue

Recently, I had to write a Django migration to update hundreds of thousands of database objects. Loading the data With some paper-napkin math I calculated that I can fit all the necessary data in memory, making the migration much simpler than it would have been otherwise. First I had to make sure to load only the necessary columns. Django’s only queryset method came in very handy:…

Migrating Gunicorn to Granian

I migrated one of my Django apps from Gunicorn to Granian yesterday. Here is how the migration went and some of my thoughts on Granian and Gunicorn. Migration This is the second time I attempted to try out Granian. The first time I got blocked because Granian didn’t support unix sockets . I run several Django apps on the same host behind Nginx, and I’m using Unix sockets for…

Disable Network Requests When Running Pytest

Even though my team has been diligent with mocking external requests, a few web requests still managed to slip through after a few months of cranking out new features. We only noticed them when our tests started to fail . 🫣 The mocking problem Usually, when you write a test for code that makes network requests, you mock your HTTP library of choice, either by using the built-in unittest.mock…

Disable Runserver Warning in Django 5.2

Django 5.2 added a new warning that shows up when you start your development server with python manage.py runserver : WARNING: This is a development server. Do not use it in a production setting. Use a production WSGI or ASGI server instead. For more information on production servers see: https://docs.djangoproject.com/en/5.2/howto/deployment/ Here is how it looks like in the terminal: The warning…

Autogenerating og:images with Jekyll

This blog has been a static site powered by Jekyll for over 13 years , and I’ve been happy with the setup. After all this time, I still enjoy using my code editor to write new posts and git commit and git push to publish them. However, there was one issue that often discouraged me from writing: I had to switch out of the code editor to generate the Open Graph image that appears on social…

Power Outages and Gunicorn PID Files

After a power outage, some of my Gunicorn jobs failed to start correctly. In this blog post, I explain why it happened and how I solved it.

UV with Django

Using UV to manage dependencies of your Django application.

Go-like Error Handling Makes No Sense in JavaScript or Python

Adding special syntax to Javascript or Python to allow Go-like error handling feels like a good idea at first glance, but I think it doesn’t improve the issues with error handling in these two languages.

Packages Do Not Match the Hashes Pip Error

pip sometimes returns a checksum error when the urllib3 library is unable to parse a received TLS packet due to a network error. This pip issue will be resolved in 2025 when Python 3.9 is EOL, but you can get around it today by using wget or curl.

Gotchas with SQLite in Production

What you need to know before putting SQLite in production

Fedidevs Dev Update #2

June update for fedidevs.com!

Django SQLite Production Config

Optimize your Django SQLite configuration for production.

Django Streaming HTTP Responses

How and when to use Streaming HTTP responses and when not to.

Deploying a Django Project to My Raspberry Pi (Video)

I made a video of me deploying a new Django project to my Raspberry Pi.

Thoughts on Code Reviews

My thoughts on code reviews.

Django SQLite Benchmark

How to configure SQLite for better throughput with Django.

Django, SQLite, and the Database Is Locked Error

Explains database is locked errors in Django when using SQLite, and how to solve them.

No Downtime Deployments with Gunicorn

This article shows how to achieve zero-downtime deploys of your Django, Flaks, or FastAPI app using only Gunicorn. It explains how to reload the Gunicorn process with the -HUP signal using systemd or the kill command directly making sure no requests are dropped during the upgrade.

SQLite Write-Ahead Logging

Speed up your SQLite writes and reads with this crazy trick. 🤪

Writing a Pytest Plugin

How to write a simple pytest plugin.

Fedidevs Dev Update #1

Discover the most favorited posts from developers on Mastodon with Fedidevs Posts.

Django-TUI: A Text User Interface for Django Commands

How I’ve built django-tui

Automate Hatch Publish with GitHub Actions

Scribbling down how I automated publishing to PyPI with GitHub Actions.

Words TUI: App for Daily Writing

I am coding a TUI application to help me with my daily writing.

Textual App Auto Reload

How to automatically reload your Textual app when code changes occur

RDS Blue/Green Deployments

Upgrading your database with Blue/Green deployments

Fly.io Certificate Renewal

Ensure your SSL certificate doesn’t expire to avoid downtime

Using Testing Library with Selenium in Python

Why and how to use the Testing Library with Selenium in Python.

The Fastest Way to Build a Read-only JSON API

A short story on how I managed to not overengineer a read-only JSON API.

import __hello__

The import __hello__ easter egg in Python.

Enum with `str` or `int` Mixin Breaking Change in Python 3.11

A change in how Python handles str and int mixins in Enum classes might break your code when you upgrade to Python 3.11.

Your Code Doesn't Have to Be Perfect

An example of smelly code that served customers for over 6 years without issues before breaking.

Fixing _SixMetaPathImporter.find_spec() Not Found Warnings in Python 3.10

I am helping a client upgrade their Django application to Python 3.10 and we encountered this mysterious warning when running the app on the new Python version: < frozen importlib . _bootstrap > : 914 : ImportWarning : _SixMetaPathImporter . find_spec () not found ; falling back to find_module () To make matters worse, this warning doesn&rsquo;t only show up once, but more than 200 times when we…

Upgrading Django App to Python 3.10

At my day job we have a Django app with almost 500_000 lines of Python code that was written over the last decade. Ever since we migrated to Python 3.7 (almost seven months after Python 2 EOL 😓), we&rsquo;ve tried to keep on top on Python upgrades. We migrated to 3.9 at the end of last year, skipping 3.8 completely. It was now time for us to jump on Python 3.10.

Integer Overflow Error in a Python Application

How we found and fixed an integer overflow error in our Django app.

Python Dependency Management

Overview of common methods for managing Python dependencies

MySQL Performance Degradation in Django 3.1

Upgrading from Django 2.2 to Django 3.2 caused a severe performance degradation with MySQL 5.7 due to a bug introduced in Django 3.1.

New Features in Python 3.8 and 3.9

Highlighting some of the new features in Python 3.8 and 3.9.

The Code Review Batch Size

In the last article we learned how important it is to reduce the friction in code reviews, by making code reviews your top priority. Based on the theory of constraints , not working on the bottleneck is counterproductive. If your code review queue is backed up, writing more code will not make you deploy features any faster! The theory of constraints doesn&rsquo;t only help us figure out what to…