After 4 years of Django, this site is now built with a DIY static site generator. I set out to write about the new static version, but I never got past the site's history. I have to maybe do a part 2 someday to cover the new static site generator.
4 years of (mostly) Django
First off, just want to say that Django is awesome and I love it. I've dabbled in Go, Flask, FastAPI, and Starlette. None of them let you build things as quickly as you can with Django. You might not always love the Django way or need all its batteries, but they are there when you do. If you ever need to reach for a database, you're going to have to build from scratch a lot of things Django gives you out of the box.
Beginning with Django
4 years ago, I wanted to learn how to build "real websites". So I ran through a few different tutorials. I'm pretty sure I started with the Django Girls tutorial and then moved onto Will Vincent's books. From there I needed a real project. So of course I wrote a blog. Somehow I skipped the obligatory, "I started a blog," post.
The website also served as a hub for many other projects (Django apps):
- jrnl from anywhere
- My own Simplenote (with extra features)
- Link shortener
- Various habit trackers
- Gym log
- Intermittent fasting tracker
SQLite, PostgreSQL, or "¿Por qué no los dos?"
I started with SQLite and in 2024, moved onto PostgreSQL for the full text search features. I wrote a bit about it. Note: SQLite does have FTS, but Django's ORM doesn't have as many (if any) features for it.
PostgreSQL has always been a bit stressful for me. I've successfully restored a database backup (at least locally), but I never felt that comfortable doing it or that I had a bullet-proof backup strategy. With SQLite, I could just download the database as a file and quickly drop it into my project or a backup drive. I wrote about that too.
Django deployment
At first, Django deployment is a circus. Everyone seems to do it a little different. I tried maybe 4 different tutorials, they would all differ a bit from my project in some way. I bet it took two weeks of working on it in the evenings to get it working right with static and media files served correctly. Now I could do it in half a day. It was very frustrating and discouraging, but, even a blind squirrel finds an acorn once in a while.
I think the #1 issue would be linux file permissions, followed by some kind of networking issue (a unix socket, reverse proxy, firewall, etc). After struggling through a few times, I got a feel for how and why different pieces fit together and it got easier to Google the correct incantation to solve any issue. Now, AI is amazing at solving these problems.
My last and favorite way to deploy was self-hosting Dokploy on a VPS.
To get there, I tried Heroku, Digital Ocean, Linode, Hetzner, Lightsail, Render, Railway, Fly.io and Appliku.
Why so many? I like to tinker, it would usually go something like this:
Step 1: Learn to deploy on a VPS because it's cheap. Step 2: What if something goes wrong? I'll try out a PaaS. Step 3: Eh, I want to use SQLite (or save money or host multiple projects or...). Back to a VPS. Step 4: Rinse and repeat.
Static curious
At some point in those years, I had been interested in static sites and explored building my content with Pelican and Hugo. I can't remember if I ever actually deployed any of them. I stayed (or boomeranged) back to Django because it was nice to be able to edit my stuff on a phone or any computer anywhere. I couldn't really do that with a static site. (You can, but it's less convenient)
The Go phase
For fun, I tried to learn Go and loved a lot of things about it.
- It's boring in mostly the best ways.
- You get so many great tools out of the box with Go that you have to assemble together in Python.
- Compiling any Go project I worked on was still faster than starting up a Python app.
- The programs run faster than Python.
- Static typing is awesome... it made me realize VSCode had superpowers I never knew existed compared to when I was writing Python.
- It feels productive.
So as I was learning Go, I picked up Let's Go and learned how to build a Go web app the Go way. Then I tried rebuilding my whole blog and app the Go way. And again, I played with SQLite, PostgreSQL, sqlc vs stdlib vs pgx, different hosting providers, etc.
My website ran on Go for maybe, 9 months? Eventually it came to an end. Writing Go code felt productive and efficient, but wasn't. It took so much longer to prototype ideas in Go than with Django. As a Dad with young kids, that was important. It was frustrating that it would take me 1-2 weeks to wire something up in Go that could be as fast as 2 nights in Django.