Matt Segal Dev

Blog Posts

How to highlight unused Python variables in VS Code

I make a lot of stupid mistakes when I'm working on Python code. I tend to:

  • make typos in variable names
  • accidently delete a variable that's used somewhere else
  • leave unused variables lying around when they should be deleted

It's easy to accidentally create code like in the image below …

A Django project blueprint to help you learn by doing

There's an awkward point when you're learning Django where you've done the official tutorial and maybe built a simple project, like a to-do list, and now you want to try something a little more advanced. People say that you should "learn by building things", which is good advice, but it …

Django project blueprint: data model

This post is an appendix to my post on designing a Django project. In this page I explain why I chose to use this data model:

app data model

I created this data model by looking at the user journeys and thinking about what data I would need to make them work. Here's …

Django project blueprint: wireframes

This post is an appendix to my post on designing a Django project. This page shows all the wireframes for the app, with some additional notes for each page.

Page designs for the user who answers the survey

This section covers the pages required for the "survey taker" user journey …

How to use both camelCase and snake_case in your frontend and backend

Python uses snake_case variable naming while JavaScript favours camelCase. When you're buiding an web API with Django then you'll be using both langauges together. How do you keep your styles consistent? You could just use one style for both your frontend and backend, but it looks ugly. Perhaps this is …

A breakdown of how NGINX is configured with Django

You are trying to deploy your Django web app to the internet. You have never done this before, so you follow a guide like this one. The guide gives you many instructions, which includes installing and configuring an "NGINX reverse proxy". At some point you mutter to yourself:

What-the-hell is …

How to manage logs with Django, Gunicorn and NGINX

So you want to run a Django app using NGINX and Gunicorn. Did you notice that all three of these tools have logging options? You can configure Django logging, Gunicorn logging, and NGINX logging.

You just want to see what's happening in your Django app so that you can fix …

How to make your Django project easy to move and share

You need your Django project to be portable. It should be quick and easy to start it up on a new laptop. If it isn't portable, then your project is trapped on your machine. If it gets deleted or corrupted, then you've lost all your work! This issue comes up …

Is Django too slow?

Does Django have "bad performance"? The framework is now 15 years old. Is it out of date? Mostly, no. I think that Django's performance is perfectly fine for most use-cases. In this post I'll review different aspects of Django's "performance" as a web framework and discuss how you can decide …

There's no one right way to test your code

Today I read a Reddit thread where a beginner was stumbling over themself, apologizing for writing tests the "wrong way":

I'm now writing some unit tests ... I know that the correct way would be to write tests first and then the code, but unfortunately it had to be done this …

Page 1 / 6