Matt Segal Dev

Blog Posts

4 tips for debugging in Django

You've got a bug in your Django code and you can't quite figure out what's wrong. You know there's a problem, but you can't quite pin down where it's coming from. This post will share 4 tips which will help you speed up your bug catching.

Dig deeper in your …

Quickly fix bugs in Django with Python's debugger

There's a bug in your Django code. You've tried to track down the problem with "print" statements, but it's such a slow, tedious process:

  • Add a "print" statement to your code
  • Refresh the page in your browser to re-run your code
  • Look at the runserver console output for the "print …

How to view Django logs with Papertrail

You have a Django app running on a webserver and hopefully you're writing your logs to a file. If anything goes wrong you can search back through the logs and figure out what happened.

The problem is that to get to your logs, you have to log into your server …

How to save Django logs in production

You've deployed Django to a webserver and something has broken. There's an error somewhere. What happened? When you're debugging Django on your local computer, you can just throw a print statement into your code and check the output in the runserver logs. What about in production? Where do the logs …

How to customise a class based view in Django

You've spend a little bit of time working on your Django app and you want to dip your toes into class-based views. The basic examples are simple enough, but once you want to do something more complicated, something more custom, you get stuck. How do you customise a class-based view …

9 commands for debugging Django in Docker containers

You want to get started "Dockerizing" your Django environment and you do a tutorial which shows you how to set it all up with docker-compose. You follow the listed commands and everything is working. Cool!

A few days later there's an error in your code and you want to debug …

Introduction to configuration management

This is a talk I gave at the Melbourne Junior dev meetup:

Have you ever found a bug in prod, which wasn't caught earlier because of a missing folder, library, or file permission? It sucks! This talk goes over some practices and tools that you can use to keep your …

Sentry is great for tracking Django errors

You've deployed a Django app to a webserver and now it's not working. Your app is throwing 500 Internal Server Errors - what's wrong? Why is this happening? It worked on my laptop!?

Even worse is when a customer experienced an error 12 hours ago and you need to figure out …

3 ways to deploy a Django backend with a React frontend

You're developing a web app with a Django REST backend and some sort of single page app frontend using React or Vue or something like that. There are many ways for you to run this app in production. There are a lot of choices that you need to make:

  • Do …

How to restart Celery on file change

I use Celery and Django together a lot. My biggest pain when doing local development with Celery is that the worker process won't restart when I change my code. Django's runserver restarts on code change, why can't Celery? How can you set up your dev envrionent to force Celery to …

Page 5 / 6