Django by Error Messages
In this lesson, you’re going to learn about developing by error messages. It’s a great way to approach programming in general.
Error messages are your friends! They’re there to help you. Essentially, the computer is telling you, “Something’s not right. Here’s a helpful tip to help you solve your problem.”
00:00 Hey, and welcome to this section about developing a Django app following the error messages. So, I’ve mentioned this already before, and now we’re going to talk about developing by error messages. You might be feeling like, “Oh my god,” or, “No, please not!” Or even, “Ahhh!”
00:18 But developing by error messages is actually a great way to approach programming, in general. That’s something that I want to emphasize a lot here, really, because people starting off with programming, they seem to think of error messages as, like, they did something wrong and things are going wrong and, I don’t know, they don’t know what they’re doing at all, and maybe have no way of continuing as a programmer.
00:40 But that’s not true at all. Error messages are your friends. They’re there to help you. Essentially, the computer is telling you, “Wait, um, something’s not quite right, and here’s a helpful tip of how you could solve it.” Okay?
01:00 We’re going to train that by developing so that at the end of this course, if you find an error message, you’re going to be like, “All right, sweet! Welcome, new friend. Let’s figure out together what’s going on.” And maybe you’re even going to end up really liking seeing those error messages around. Okay, great.
01:16 So, Django has an actually very, very nicely built-out way of showing you error messages. Okay! So, let’s take a look at a Django error message. I headed over to my PyCharm, and here I’m going to start again our development server.
Now, we’re going to head over to look at how an error message would look like. For this, I’m going to navigate to a URL called
/portfolio. We’re gonna build that one out later, but currently, if I go there, Django’s telling me, “Well, there’s nothing there,” or, “I can’t find what you’re telling me to find,” because we didn’t create this yet. We didn’t make a
02:18 These URLs don’t exist yet. So, what Django is telling me is, “I can’t find this page, sorry.” And the HTTP error associated that you’ve seen up on the web a couple of times is 404, which is essentially just, “I can’t find this resource.” You’re going to see this structure of error message often with Django.
02:36 So, we have this yellow bit at the top that tells us the name of the error message, and some helpful information. It’s telling us, “This is where I tried to find it. With this method, I tried to get something from there and I got a 404 error.
03:17 And this is currently not working, so check that out,” et cetera, et cetera. So there’s helpful tips in here, in these gray parts. We’re going to take a look at those more once we encounter more and more error messages while developing our app.
Become a Member to join the conversation.