Matt's Dev Blog

How to automatically reset your local Django database

Sometimes when you're working on a Django app you want a fresh start. You want to nuke all of the data in your local database and start again from scratch. Maybe you ran some migrations that you don't want to keep, or perhaps there's some test data that you want …

How to automate your Postgres database backups

If you've got a web app running in production, then you'll want to take regular database backups, or else you risk losing all your data. Taking these backups manually is fine, but it's easy to forget to do it. It's better to remove the chance of human error and automate …

An introduction to cloud file storage

Sometimes when you're running a web app you will find that you have a lot of files on your server. All these files will start to feel like a burden. You might worry about losing them all if the server fails, or you might be concerned about running out of …

How to backup and restore a Postgres database

You've deployed your Django web app to to the internet. Grats! Now you have a fun new problem: your app's database is full of precious "live" data, and if you lose that data, it's gone forever. If your database gets blown away or corrupted, then you will need backups to …

A tour of Django server setups

If you haven't deployed a lot of Django apps, then you might wonder: how do professionals put Django apps on the internet? What does Django typically look like when it's running in production? You might even be thinking what the hell is production?

Before I started working a developer there …

Studying programming: where to start

You have zero programming knowledge and you want to start learning to code. Where do you start?

Maybe you want to learn enough to get yourself a coding job, or you're planning to study computer science in the future and you want to try it out before you start your …

Studying programming: pace yourself

You can learn programming all by yourself and get a coding job. Just you, your laptop and the internet. It's great! You don't have to pay thousands of dollars for a degree and you can work at your own pace.

There's a problem with this approach though: with no teacher …

Studying programming: tools or theory?

When you're studying web development you have a lot to learn and limited time. One of the hard choices that you'll need to make is whether you learn tools or concepts. Should you study data structures and algorithms to be a web developer? It seems kind of esoteric. Do you …

How to diagnose and fix slow queries with Django Debug Toolbar

Your Django views are running slowly and you want to make them faster, but you can't figure out what the issue is just by reading the code. Just as bad is when you're not sure if you're using the Django ORM correctly - how can you know if the code you …

Studying programming: what to learn next?

A lot of people trying to teach themselves programming have an anxiety about what they should be learning. There is an endless array of options - you've seen these ridiculous lists of online courses, right? There's too much to learn and not enough time! You don't want to waste time learning …

Keeping your config files valid with Python

It's common to use a config file for your Python projects: some sort of JSON or YAML document that defines how you program behaves. Something like this:

# my-config.yaml
num_iters: 30
population_size: 20000
cycle_type: "long"
use_gpu: true
plots: [population, infections, cost]

Storing config in a file …

8 helpful tools for programming on Windows

Software development on Windows can be a pain. Not because of any issues with C#, .NET or the operating system, but simply because the tools surrounding your work can be quite clunky by default. I'm talking about the lack of a package manager, PowerShell's ugly blue terminal with no tabs …

Run your Python unit tests via GitHub actions

You've written some unit tests for your Python app. Good for you! There are dozens of us, dozens! You don't always remember to run your tests, or worse, your colleagues don't always remember to run them.

Wouldn't it be nice to automatically run unit tests on every commit to GitHub …

Simple Django deployment part six: domain setup

We're very nearly done deploying our Django app. There's just one more thing we should take care of. Having a raw IP as our website address is kind of yucky, isn't it? You're not going to ask your friend, boss, or mum to visit 23.231.147.88 to check …

Simple Django deployment part five: deployment automation

Deploying our Django app involved a lot of different commands, right? It would suck to have to do all that over again, wouldn't it?

Having to manually type all those commands again would be tedious, slow and easy to screw up. Even worse, the harder it is to deploy, the …

Simple Django deployment part four: run a service

So we've got a problem. Our Django app only runs when we're logged into the server via SSH and running Gunicorn. That's not going to work long term. We need to get Gunicorn running even when we're not around. In addition, if our Gunicorn server crashes because of some bug …

Simple Django deployment part three: deploy code

We've got our server set up, and our Django code is ready. Now we can actually deploy Django to our server. The goal of this section is to get a basic deployment done. We'll do some automation and introduce some extra tools later.

In this section we'll cover:

  • Windows line …

Simple Django deployment part two: local setup

We've got our server set up and ready to host our Django app, now let's focus on preparing our app for deployment. The goal of this section is to set up and test as much of the stuff that we'll be using in production. That way, we can debug issues …

Simple Django deployment part one: infrastructure

In order to deploy our Django app, we need a somewhere to run it: we need a server. In this section we'll be setting up our server in "the cloud". Doing this can be fiddly and annoying, especially if you're new, so we want to get it right first before …

Simple Django deployment: a guide

You're learning web development with Django. You've followed the official introductory tutorial and you can get a Django app working on your local computer. Now you want to put your web app onto the internet. Maybe it's to show your friends, or you actually want to use it for something …

Page 2 / 3