Django Chat

How to Learn Django (Ep2 Replay)

Episode Summary

Carlton and Will discuss how to learn Django whether you are a total beginner or experienced web developer.

Episode Notes


Support the Show

This podcast does not have any ads or sponsors. To support the show, please consider purchasing a book, signing up for Button, or reading the Django News newsletter.

Episode Transcription

Carlton Gibson  0:06  

Welcome to another episode of Django chat. I'm Carlton Gibson, and I'm here with Will Vincent. Hello. Hello, this today we're going to talk about how you learn Django. And what that involves. So well.

Will Vincent  0:18  

How do you? Yeah, well, let's let's tee this up slightly with our background. So, you know, you are the one of two current Django fellows. I teach Django for a living. I think the challenge of Django is people are coming out at different levels. So we'll try to address all of those whether you're a total beginner and you've never programmed before, or maybe you know, Python, but not web development. Or if you're coming from a different web framework, and you just want to know what's different about Django. So assuming you're a total beginner, I would say, I would not just start with Django. I would start with HTML and CSS and building some static pages. Personally, I think it's too much to jump right into web development. That's what I would do. I'd build a bunch of static pages, very briefly kind of understand how that is. One of the big questions is how much Python do you need to know before you jump into Django? And this is one where I think my opinion, you'll hear very different things on this. So I think you don't need to know that much. I think it's important to build things and backfill. And so I think it's good to go through some basic Python exercises, and more is better. But I think you can kind of just jump into Django and build some quick stuff and feel that power, and then backfill, I don't think you need to have two years of Python experience beforehand. When you think about that Carlin, I think that's probably the biggest one is how much Python do you need to know before you jump into Django?

Carlton Gibson  1:35  

Python could be like, assuming you know, a bit of HTML and CSS so you can build a basic web page. If you know that much. Then you could actually learn the dynamic programming bit the Python bit by just getting started with Django. Yeah, and I completely agree. You need to understand anything, but yeah, it's go through some tutorials, you could copy and paste bit, you could learn a bit and you'd be creating views, you'd be using templates, you'd be using the ORM, you'd be creating some models, you'd create the admin but you do these things. And it Okay, it would slowly start to come here. But you could literally go from knowing nothing. And Django would be a great way into Python if you if you didn't,

Will Vincent  2:20  

I agree, because I think, you know, with Python, some people get excited about, you know, doing the Fibonacci sequence, or, you know, calculating prime numbers. And that's like the computer science types, and God bless them. But most people don't care about that. They don't get a thrill out of outputting stuff to the command line, they want to build something real. And so I agree Django is a good way to use Python in a practical way. You know, I see I've had this debate with other people because there's more, you know, people typically the computer science degree who say, I think it's even What's his name? Jeff. Jeff Nup has a post saying learning. Django through Python is considered dangerous where he advocates not doing this. And I disagree. I think his point is, you're gonna learn learn bad things. practices learn the basics first. But you know, it's hard to learn the basics when you don't have any context. And Django is one of the best ways to have context because you're actually building something real not fiddling around with calculating mathematics. Yeah, like so it's a question of I think it's a question of ordering, right? Like, you need all of this. The question is, how do you? How do you get all that knowledge? And how do you do it in a way that you stay interested? Because if you just dive into all the abstract stuff, without context, it's really hard to stick around. And it's not that interesting. And even though you learn it, you're not learning it in the same way, like learning about databases. You can learn all the theory, but it's not the same as having built the site and feeling the problems and then, like, you're having your mind blown of like, Oh, I was struggling with this problem. Here's this amazing solution when someone just gives it to you. It doesn't, doesn't sink in or you don't get it.

Carlton Gibson  3:47  

Yeah. And like the people who went to university and studied did a computer science degree, they already knew how to code when they got there, right. They may not have been the world's best programmer, they may not have known data structures or the insides of a binary or any of those things, but they already were computer literate. When somebody's coming to programming from the real world, they they've got a job to do so that they either want to do some statistics, which they need to get out slightly further than Excel. Or they need to build a website or a web application, in which case, to get going with Django, it's just perfect. And you don't need to know SQL, because you've got the, the ORM. And that's a nice way and then yeah, later on, you'll need to know about indexes and about joins and about how you can optimize queries. Because if if your application gets any traffic, which most applications won't, because they're in their corporate internal things or whatever, yeah,

Will Vincent  4:41  

but that's like telling someone their baby is ugly. I mean, they hear it they don't hear it.

Carlton Gibson  4:44  

Yeah, but you don't need you don't need to know about you know, even select related usage in the in the water mo need these advanced topics until your application has a problem.

Will Vincent  4:55  

Yeah, I agree. It's it's the step by step sequence and the best way is to feel the problem. To learn it, you know what you said about university? I want to add, you know, I think one of the reasons why computer science scares a lot of people is because so many people come in with years of programming experience and Okay, they don't know data structures, but you know, maybe they built sites with PHP or something else for years. And so, you know, half the class has that background, half the class, maybe it's just taking it for the first time and they just feel stupid, because they, it's one of the only, you know, disciplines where you have such a disconnect and experience, right? You don't have that with organic chemistry, in the same way. So, you know, that's a separate, separate pedagogical thing, but I think one of the reasons why computer science is really scary, as you know, they hit you with the fundamentals course, you jump right into data structures, and algorithms. And you know, at least half the class has already has years of experience on you and and it's already a hard course for them. So it's, I really wish there was maybe a two track system like you're actually a beginner versus, you know, you've played around with stuff for a while because a lot of people you know, you internalize and you think oh, I'm stupid or I don't get it. And that's really not the case. But that's a separate discussion. We can have.

Carlton Gibson  6:07  

Yeah, I mean, I, for me, I think the computer science stuff comes, okay. It's great if you you know, if you're going to study computer science as an awesome way to go about it, but if you are a jobbing person in the real world trying to get something built, you don't need any of that. You can just start putting stuff together and yeah, they'll there'll be performance problems and all sorts but they would those later on.

Will Vincent  6:30  

Yeah, learn by doing for sure what let's just start off where are some of the good resources? This is a good question for people. How do you learn Django? I mean, my. I typically tell people, you know, if I don't know their background, I say go try the official polls tutorial, which is really good. But I would say it's at the intermediate level. It's for someone who's new to Django but not new to web development. So I typically say try that out. If you get it, boom, off to the races, jumping, the documentation is really going to work for you. If it doesn't work for And for a lot of people it doesn't because they don't know web development, or the shell is scary, all these sorts of things, then I then I recommend dropping down a level and saying, you know, Django girls has a great tutorial. I've got a bunch of great tutorials on my personal site, you know, Django for beginners. So I think that's a good way to level set. But, you know, I tell people don't that tutorial is not for total beginners.

Carlton Gibson  7:23  

Yeah, it's like on the Python website, the Python tutorial. Yeah, it kind of you couldn't learn programming from that. If that was your first exposure. If you know another programming language, then it's great because it explains data types in the data model, and what's unique about Python, but it's not a big Python for beginners.

Will Vincent  7:42  

Now, and I mean, I think there's because I've thought a lot about this over the years, I think there's two factors. One is that when you're writing that, it's more interesting to write to your peers. So the person who wrote the tutorial Initially, the person who wrote that Python one, you know, they are an experienced engineer, so they're sort of explaining it as they would explain to maybe a junior to developer, I don't think they have talked to a total beginner recently. And it's also just a lot more work to do stuff. For total beginners. I mean, I, I always, you know, I always say I start from the beginning, I never leave out a step. So I say, like, literally, here's how we create the directory for our code. Here's the text editor. And it seems mundane, it's, it's not interesting for me to write, but you lose so many people right off the bat when you just jump in, you know, and I'll give an example. The Django documentation, I don't think mentions virtual environments, anywhere. So I'm pretty sure if it does now, it didn't in the past. So you know, which is it's not jangles fault, per se. But for example, when I started using Django, I just jumped in. And then I got all sorts of weird bugs because I didn't know Python very well. And then later, I was like, Oh, I wish I'd known about virtual environments. So, you know, the Django Doc's can't do everything for you. But I think that's, you know, that's another you know, what is the step by step process for someone who comes in I mean, so I always say tried it, you know what, before that install Python three, which is its own challenge, actually, that's a huge stumbling block with JavaScript doesn't have.

Carlton Gibson  9:10  

It's a huge stumbling block for people who are really new to programming to this kind of stuff. And it's like, what's not appreciated, I think is quite how difficult non programmers find those first steps. Because it's cryptic, error messages. And it's slightly different version numbers. And, yeah, the information overload is already so high that people just get get stopped.

Will Vincent  9:34  

Yeah, you can't even you can't even start I mean, on my site, and I'll link to it. I have tutorials on how to do it on Mac, Windows, and Chromebook. And those get massive traffic. Those are the top posts on my site, which gets a fair amount of traffic, you know, down the line, I'd like to do a YouTube thing where I take a fresh computer and do these installs. But the challenge the challenge with that is if you ask an engineer, there's multiple ways to install Python. And they will say, Oh, you could do this. You could do that. You could do this. I mean, you Go to the official Python site. And it's like, oh, just download the binary. You know, what's the binary? You know? Yeah. Where do I put beginners? And how

Carlton Gibson  10:07  

do I install it? And what does it mean when it says, when the box comes up and say, Would you like me to add this to path? Sorry? What's path?

Will Vincent  10:14  

Yeah. Why is it all parameters? And yeah, how on earth would I understand what that even meant? Right? What's path? What's command line? You know, so I'll link to those posts. But I think I have empathy for that, because I went through that and I think a lot of people mistake how hard that is to set up. You know, because we, you know, as a professional, you sort of set it up and you forget about it or you you internalize how hard it is to set up but even forget, even forget the

Carlton Gibson  10:41  

hours that you spent banging on a screen that wasn't working without knowing why and the googling that you did to find the answers and the years of doing that over and over and over again. You forget that you you tell yourself that that didn't exist or something because it was so scary, but yeah, yeah, beginners. have that experience every single time they try?

Will Vincent  11:03  

Yeah. And I, I, you know, I always tell people find, find someone who's a beginner and just just ask them, show them how to install Python three. And watch what happens. I mean, I just had that somewhat recently, someone, I work at a co working space and I was like, Oh, yeah, you he doesn't know how to code. I was like, you can just download my book. You know, let's jump in. And he's on Windows. And, you know, it took me an hour to set up his computer for it. And, you know, he never would have gotten started with

Carlton Gibson  11:32  

Django con last year and talking to somebody who wanted to partake in the sprints. And I'm like, Oh, you know, you just download Django, pip install the record, create virtual environment, pip install the requirements, run the test suite. So he's like, yeah, look, I've done all this and it doesn't work look cool. Some cryptic error messages. So we sat there all lunchtime, fixing that.

Will Vincent  11:51  

Yeah. Well, we were x. Yeah, yeah. Well, and that's Yeah, yeah. Yeah, it well and that, you know, virtual environments, too. I mean, there's pips. There's PIP m vam. You know, that's a whole other. So I think, you know, again, I'll provide links I think for beginners don't overwhelm them just give them something that works you know, you just need something that works you know as experts I don't care if you know if I have a choice I like PIP them but I don't care if it's PIP I don't care you know, it doesn't matter to me it's whatever it's someone started the project uses but as a beginner just got to blast through that stuff

Carlton Gibson  12:25  

somehow get up and running. I mean, this is the this is the thing is how can we get to the point where Django admin start project works?

Will Vincent  12:35  

Right, right. And this is as quick as possible. Right? When I think of this as this is the pyramid of learning how to code where the basis it's just way more things and people think about it the basis typing, you have to be able to type proficiently and not have that be a barrier. Then you need command line and navigating your computer. You know, I think about how to make that interesting for people. I just taught something recently I taught over lunchtime. bunch of people how to build a build and deploy a website, in an hour, which you can do. And, you know, they, the file system, the directory structure, even though it was visual, I was saying, you know, put this on your desktop, or if you're on Windows, your home thing, you know, people have never had to do that. And so they just, we didn't even use the command line is still just finding files, you know, naming files, right? I said, Don't capitalize them don't have spaces, you know, but I say it and you know, they need to make the mistake to see it. There's just so many things. So you have to navigate command line, then you get to a programming language, assuming you can install it. Then you get to a web framework, and then you have you know, you have databases and you have security and templates and HTML, CSS JavaScript. So you know, it's not a problem, but it's a pyramid of stuff like and

Carlton Gibson  13:47  

you think how do you know we just get going just open the terminal, and then you've got you're presented with bash, right? And it's like bash is great and it's lovely, but there is arcane knowledge beyond arcane knowledge involved in using bash. Yeah, and yeah, if people have CD, oh, you know, yeah,

Will Vincent  14:05  

I mean, it's, it's, you know, even though it's, you know, six eight commands is almost everything you're going to use. It's super scary to people, and you can nuke your computer. You know, I always actually show people, I'll show them the, you know, I forget off the top my head, I think it's in the book to actually I'll say like, if you ever see this, you know, to like sudo you know, or RM dash r star, like, do not do that. It's really a scary thing. Anyway, so there's a lot to learn. With Django, I think, install Python. Just jump right in the other arm resources

Carlton Gibson  14:38  

to mention two tutorials. You mentioned the Django tutorial in the Django girls to tour the other one is very good as the Django rest framework tutorial. It's nice and simple, nice and low level, you know, relatively speaking, it's equally low level as these other things, but if you were to go through those retour free tutorials and be able to do that you would know a lot actually able to then build a web application?

Will Vincent  15:02  

Yeah, I mean, you know, so it was not that long ago that I was learning Django rest framework. And I had trouble with the official tutorial, because I think it's it's again, you know, maybe it's me, but I think it's also a little bit at that intermediate level. Which is why, you know, so I actually, I think I have a big, I've written a bunch of little bit lower level tutorials that are sort of, you know, again, try that one, try the official one, if you can get through it great. If not, there are some resources. So we'll link to all that. And there's also there's a number of YouTube channels that are growing up that I linked to my awesome jenko repo. So it's, it's getting a lot better. But there's still, there's not that much, right. There's not that many Udacity courses. I mean, it's it's always kind of mind blowing to me that Django is as popular as it is. And yet, it's woefully underserved by educational content,

Carlton Gibson  15:53  

but it's I don't think it's better for other you know, it's that barrier to entry to programming. Yeah. All, like, we're just we're just not a computer literate culture

Will Vincent  16:04  

yet. Well, and I think a lot of people learn, you know, people learn on the job. So you know, yeah, historically you would get, you know, you'd grind through a computer science degree and you'd have all this abstract knowledge, but you don't know how to code. You don't know how to do web. I mean, many of the readers of my book, our undergraduate graduate students in computer science at very good schools, they just are never taught this.

Carlton Gibson  16:24  

Yeah, because it's all C and Java and stuff,

Will Vincent  16:26  

C and Java. And, you know, I understand I mean, you basically have to be an adjunct to teach web stuff, it changes so rapidly. And I've taught, I've taught it as an adjunct, you know, the challenge is, I love teaching at the college level, I'd love to do more of it. It's giving my time away. Yeah. And, you know, I think the only way you can really do it is if you're a practitioner at a company, and the company will compensate you for your time and you use that time to hire the best students. That's about the only way or you're financially set because I mean, the amount of money that you make is It's just, it's not even close. Yeah. Okay. So. But it's a challenging thing, because that's,

Carlton Gibson  17:06  

that's because there's a skill shortage, right? So the market for people who, presumably you can code if you can teach coding, I mean, I know teaching and doing it are not the same thing. But you must be able to code to be able to teach code at some level. But the market for working coders is much more competitive than the market for teachers teaching.

Will Vincent  17:25  

Yeah, absolutely. I mean, it's, it's a good problem in a way, but it is a problem as a whole separate,

Carlton Gibson  17:31  

massive skills.

Will Vincent  17:32  

Yeah, separate discussion, but I think it's economics one. Yeah, but certainly with practical stuff. So data science, web stuff, it's rare that a tenured professor is up to date on them, because that's not what they do. And yet that's what students you know, people in the real world will jump in and do. So there's a disconnect there. But that's

Carlton Gibson  17:50  

always the disconnect between academia and industry, right? In every every field,

Will Vincent  17:56  

but it doesn't have to be like that. But yeah, maybe I'm not Yeah, I think Taoists Yeah, anyway, let's get we'll save the philosophy for it. Okay, so moving on. So what's so what's challenging about Django? So I, you know, I think the biggest one, once you've gotten into it is this idea of, for things for one page, so you need a model of you a URL, and a template for, you know, for your average page. And so that's, you know, four things for one page, the order doesn't really matter, you kind of need them all at once. So that's a big stumbling block I see with people is they'll say, Well, you know, what did you do them in? You know, I know, it's hard to be iterative on that, because things will just break in different ways. And eventually, you learn to know the error messages and see, Oh, I forgot this. And then eventually, you just know that I need a model, I need a view, I need a template. And I need a URL. And I don't see any consistency among experts on the order in which they do that. I mean, you know, for me, I probably would go model URL view template, but not always. I don't know what what your take is on that.

Carlton Gibson  19:02  

Yeah, no, I mean, I almost almost always start with the model. So I, you know, create a model. These are this is what I want to say, these are the kind of data I want to save. And then I'm thinking about the URLs that I want to use, you know that if I want to create a list view, what what would the URL be for that, and the kind of goes together, and then I might create a rest framework serialize, or write a form that goes around it. So because I'm thinking about the fields, and what type of data that wants to say, and almost instantly I'll create an admin so that I can start playing with it in the admin, I can create model instances I can see and then Okay, I'll create the view.

Will Vincent  19:40  

Yeah, that's true. That's true. One serializers will will do a separate thing on how to learn Django rest framework. Because Yeah, okay. So it's basically all about serializers. But well, that'll be a separate thing. But I agree. I mean, you start with the model, think about the URLs and then admin, but it's just something you just need reps. You just need to build a bunch of sites. And, you know, it's sort of a, you know, same thing with, you know, learning like react in particular, it just at some point it clicks. And you sort of, like, why was that hard? But that's a huge, that's a huge one that people teaching others don't necessarily see. And it's the ordering which makes sense, you know, how, which order do we do? It's like, well, it doesn't really matter.

Carlton Gibson  20:19  

Depends. I mean, you might, you might do it template driven, because if you've got a clear design about what it's to look like, you might say, okay, is so quite often in freelance contracting work in agency work, you get given a very rich comp, like a Photoshop comp of what the site's to look like. And so you start with templates. Yeah. And then it's like, well, what are that? What are actually the data fields and you start extracting the model from the templates? And you ask, you know, if you were to ask the designers for a model, or JSON schema or something, they wouldn't be able to give it to you. I think yeah, it's not their skillset. I think that's and so you have to extract those in that's Yeah,

Will Vincent  20:54  

I think that's changing a bit that but yeah, but traditionally that's the the barriers of entry. For the barriers between the two disciplines, and I would say, you know, this seems overwhelming, the way to think about it is, there's really only three types of pages you're going to have, which is represented by a generic class based view, either or listing information. So your blog, your listing all the blogs, you have a detailed view, which is an individual blog post, or you have a template view, which is a static thing that isn't driven by a model. So the about page or the contact page, almost every page is one of those three, it's either a list, it's a detail in an individual one, or it's a template that isn't using a model. Do you agree with that? I

Carlton Gibson  21:34  

didn't know entirely. I mean, you know, most of you, not every page that almost every patient, like some of form pages where they accept him, but But yeah,

Will Vincent  21:42  

in the same way that with time you just see, you see that every site is you know, 90 95% exactly the same, which is why you have frameworks but you also the idea of crud, create, read, update, delete, that every website has basically the same functionality. You know, people don't also don't understand that at first and it takes us While to say, look, it's it's all crud. And it's some sort of form. It's kind of it. But you know, so that's one thing I do with people is I say, you know, I'll say, Look, I'm gonna tell you that all these popular sites are basically the same if you're going to prototype them, Facebook, Twitter, Pinterest, and then I'll walk through the models and just say, look, this is, you know, this is how you do it, maybe you have a foreign key. Maybe you go crazy, and you have a many to many with, you know, like comments on Twitter, but that's it. But I think you need, people need to have someone break it down for them. Because once you get into the details, you know, details are hard, and it becomes overwhelming. But fundamentally, the web is not rocket science. And if it is, you're probably doing it wrong, unless you really, you know, unless you really, really know what you're doing. You know, so if you think you're being special, I would really think again, because chances are you're complicating something that's already been solved. And there's a more elegant way to do it. Because again, nobody cares how complex your code is.

Carlton Gibson  22:54  

Yeah, no, it's that classic line as well as if it codes harder to read than it is to write So yeah,

Will Vincent  23:00  

if it's if it says complex code as you can possibly write, then by definition, you can't read it. Yeah, you can't understand it like, Yeah, well, that actually, that leads into another area, which is views. So Django has both class based and function based views, I generally start with generic class based views, and then go down to a class based view and then go to a function based view. But I think, you know, the challenges that when you're to truly learn how to attack the, you know, one specific method within a generic class based view to customize it, you kind of need to understand you need to understand everything within it. So there is a, you know, you sort of start there, you go down, you need to be able to the function based views, but then you can, you know, more elegantly customize the generic class based view, but that's, you know, you'll see because people when read people are reading tutorials, or they see different things they'll someone will say, function based views all the way someone else will say class based views all the way. And I we could we'll probably do a whole episode on that. I think that elegant, easy to read code is where you want to be and so classes and Django The thing with the Django is built with class based views internally almost entirely at this point. Now, yes, yeah, more than functionally, I mean, you know,

Carlton Gibson  24:09  

what's internal? Like,

Will Vincent  24:10  

the admin the source code? Yeah, the source codes. It's You got it, you got to get out and look at the source code. It is mix ins and class based views.

Carlton Gibson  24:18  

Yeah, I mean, if you look at the author's for instance, that kind of thing you'd like the password, reset viewers, classmates, etc. Like these kind of views yet. For me that the idea of a function based view, it's it's cleaner, it's what it is not cleaner it by the time you're

Will Vincent  24:32  

doing Yeah, it's 2020 lines long. It's not it's too much to read.

Carlton Gibson  24:37  

Yeah, but it's been if it's 300 lines long, because you're doing all these clever things which can be wrapped up in the generic class based views where you just define a few things. Yeah, which point is it simply, there's a package dimension here as well called Django vanilla views, which introduces class based views, but they're they're much simpler structure than the ones Jango chips itself. And so they'd like an alternative. permutation of the class based views. And what's nice about those is to play with them and see the structure and you say, Oh, I see the logic. And then if you map them back to jangles, more powerful, but more complex class based views, it's like, Oh, that makes it interesting. I see what's going on. It's a good learning path there.

Will Vincent  25:17  

Yeah. Well, there's there's also classy class based views, which will,

Carlton Gibson  25:21  

that's that I was just about to mention that that's, that's absolutely super resource. Because, you know, if you're looking at the year index archive page, it's like, oh, well, that's got like 40 methods, and where do they come from? And what do they look like and which ones don't have to override to customize this?

Will Vincent  25:40  

Yeah, it's too much to internalize.

Carlton Gibson  25:42  

Yeah, it's a super resource. Yeah.

Will Vincent  25:44  

So we'll link to that. You know, another big one is for learners is multiple ways to do the same thing. So start project, you know, when you run the start project command, if you add a period, puts it in the same directory. You'll see that different ways templates. You'll, you know, you can be within the app or you can go project level that's confusing to people, settings, files, you know, settings files is a big one, actually. Because you can, you know, how do people learn about debug mode? Right? How do you learn about environment variables, you kind of move along, and then you, you know, you have to get bitten by that. I mean, you know, with settings files, for example, many people do, what two scoops of Django book advocates, which is having a local a dev and a production settings file, so multiple settings files, whereas I believe that today the way to do it is with environment variables. So you have one settings file, and then you have your local or, and then your staging or production variables. And so that's much cleaner, but getting settings files in sorry, getting environment variables into your environment, when you run your app is actually

Carlton Gibson  26:50  

quite a skill. Nice. Yeah, it's not it's non trivial for a big for beginner to pick that up. It's actually quite difficult. So I agree. Yeah. Separate, separate settings files can be easy, easy.

Will Vincent  27:03  

Yeah, I mean, you should use one. But well, no. The other one too is that Django is customizable. So like, I have a post a link to about how to do about page three different ways where you can put the view in the URL. You can hard code it, you can have the template, you know, that's a, that's a teaching thing that I I used to show to beginners, like, look how cool Django is. And now I think it's, it's a little bit later on, because once you when you're learning, you want to have guide rails. And then yeah, yeah, as you advance, then you sort of see Oh, I can, I can do whatever I want with Django. Actually, there's a lot of flexibility in there. But that flexibility comes at a cost to beginners. So the big advice for beginners I think, is just try to find some good tutorials and just complete them and know that there are some differences of opinion. But as web frameworks go, Django is actually pretty good in terms of being consistent.

Carlton Gibson  27:55  

There is no web framework out there, which is totally simple. And totally obvious because the domain is difficult. Yeah, it's not, you know, you can only make things as simple as the domain itself. It's it's a complex domain. And so there are lots of moving parts. It's, there's no way around.

Will Vincent  28:14  

Yeah. Let's see. Another big one with web development, I think particularly with Django is the user model. So this is what you use for login, logout, sign up. In Django case, you have a lot of flexibility. But you for example, you have to do your own signup, view and form. You can use a third party package like there's a bunch of them Django all off. But Django, you there isn't just a up you have to write those yourself. Where which, yeah, you know, some other frameworks just give it to you out of the box. So when you have experience, it's nice that Django lets you truly customize it, but when you're starting out, again, you know, one of my top posts is on custom user model, because that's a whole sort of mess. I would say I mean, I mean, I understand, you know, has legacy reasons. And I, you know, I'm, well, you know, we will talk at some point, you know, right now you can just use the built in user model, you can also do a profiles approach, which would you use, this

Carlton Gibson  29:20  

is what I do. Yeah, so I use this. So like, you can create a custom user model, but it's a lot of work. And it's opens up, you end up I've seen custom user models with 58 fields. And you're like, this is meant to be for authentication. And the old fashioned way, which I still use is to create a one to one profile model, which links to the user and then put extra fields in there. And then for authentication, the user model is very minimum. Yeah. And then I can store whatever other fields I want on the on the profile model.

Will Vincent  29:52  

And that works and do you do was very, and by the way, in silver listeners, the reason why you would use a custom user model so you can update the signup form. So instead Have the default user email password, you could add in a name field, you could add an age, all sorts of which typically as a project grows, you will want that flexibility. And if you do not have profiles or custom user model, it is challenging to update a Django application to do that.

Carlton Gibson  30:15  

Yeah. So the, you know, if you wanted to store an age or something, not in these GD p r days, I'm not sure how it works. If you wanted to store a date, you do it on a profile model, which link over me, you link it one to one to the user model. And so extra fields just live there. And then when I want to select the user, with the profile, I select the profile, but would select related on the user. And I get both at once.

Will Vincent  30:36  

Yeah. Do you do you know the history of why custom user model approach sort of superseded profiles in terms of the documentation, at least at least because I don't I

Carlton Gibson  30:45  

don't think people people wanted custom user models like it was a repeated request. People were like, I want to customize the user model. And it became, you know, something that was brought in for that reason I think it was you Using mind,

Will Vincent  31:00  

yeah, well, there's so well, I don't know, if there's a good profile tutorial, we'll try to find one. But I have some good ones on custom user model. And I'll link to those. Because that's another gotcha. As you're learning, you know, you.

Carlton Gibson  31:12  

Yeah, I mean, the difficulty is that, at that point that you before you understand what, what's going on, you have to create this custom user model and create this migration for it. And you have to set the the auth user model setting before you've run, migrate. And if you don't do that, you have to start again. Because

Will Vincent  31:33  

Yeah, so if you don't, if you don't set this up before you run your first migrate command, you you're in a bad place, because Django will automatically link up the admin in particular, but other parts of the site, other parts of your site with whatever user model is there. So it's, it's it's possible to do with with profiles, it's possible to do a custom user model in just a few lines of code. But it's a complex topic and you And

Carlton Gibson  32:00  

like what this is one reason why I like the profile model approach is that I can just start with the built in user model, I just start and then later on when that when the requirements for extra fields come up, I can add them later without having to think oh, no, now I've got to rebuild my project. Yeah,

Will Vincent  32:16  

I mean, because I agree. I mean, I think about this a lot when I write tutorials, because it's, it's a lot of extra steps and complexity to introduce a custom user model. But you almost always will want one. So it's, you know, I think really, actually, I talked with online with Tom Christie about this, I I wish the Jango had a way to include it by default. It's something that I don't think should be really an option for people. You know, and maybe there's a way to do that with the start project command. But it's I, you know, I feel like it should probably be, what do you think, as Django fellow about?

Carlton Gibson  32:54  

Well, I'm just thinking I'm thinking about it as you speak. And I yeah, you could create a template. What I actually think is just use the profile country bolts user model and then create a profile model with a one to one link to for additional fields. Like I've been through this Yeah. And that's I've come out the other side and I go with the old school way, and I like it and I could just be an old I could just be too old now and I'm

Will Vincent  33:18  

gonna get off my No, I see I see it both ways. I mean, I don't I don't I wouldn't say it's right or wrong. You're always going to need extra fields. It's actually use it Yeah, you're gonna have to do one or one or the other.

Carlton Gibson  33:30  

I wish I for me, when you that point where inspiration is perishable, and what that star project point, I just want to get off the mark. And that's why I go the way I do but there's no right and wrong here. This is the thing. This is the point for this point. And

Will Vincent  33:43  

it is the frustrating thing for beginners. It'd be easier if there were

Carlton Gibson  33:46  

or we could talk all day about which is the right way to do usable and why I do it this way when you do it that way. But it doesn't matter ultimately. That way when you're learning it's it's it's something else on the learning. Yeah, it's Something else which makes it different than a checkpoint.

Will Vincent  34:01  

So I think the maybe the last big topic is deployment while there's testing, but that's a separate, we'll do a separate thing on that.

Carlton Gibson  34:09  

Yeah. Yeah. No testing with it. Definitely. So it's a deployment. It's on podcast. Oh, my word deployment. I mean, brief. Yeah. This is what's good about the Django girls tutorials. At least you get to deploy your application. Yeah,

Will Vincent  34:19  

because it does. I think white on anywhere now, I believe is the one that uses so Django gives you a lot of flexibility. But it's sort of on you to figure out how to deployment you can use there's a link to it, there's a deployment checklist that I would say most people don't know about, that you can run to see things like did you change the bug? Did you do allowed hosts a whole bunch of settings that you would want to change for a production ready application. But really, you have your options, our platform as a service, so Python anywhere Roku? I believe on rep that you can do that, too. We we should get them on the show to talk about it. or Google Cloud Platform. Yeah. As your Yeah. And then your cloud AWS Elastic Beanstalk, beanstalk, and then step from there you have, you know, Digital Ocean Rackspace linode. Where you're they do platform as a service. No, no, I'm sorry. I'm just saying then you're just it's not a platform as a service. But if you wanted to do a deployment, you could control it. Okay. So then inside it,

Carlton Gibson  35:19  

put it in a virtual machine, or Yeah, Docker eyes it if you can do that,

Will Vincent  35:24  

but do you agree with those three levels? Because I think it's, you know, like karoku, Python anywhere then you would have Google AWS Azure, and then you would have Well, okay, so the virtual machines, the

Carlton Gibson  35:34  

Hiroko, the cuz Google have their app engine, which is like a platform as a service, same as Heroku. And then as your app service and Amazon have got Elastic Beanstalk. It's like hosted run to share. Yeah, right. So that's Platform as a Service, I would call it and then beyond that, you've got just compute. So you've got the PC to and virtual machines in as your own whatever. Good vocals and. And that would be where you're, you're provisioning a virtual machine and then you you copy across your code, somehow you migrate your database, somehow. All of these services may now have managed Postgres instances, or managed my SQL instances, which saves you a lot of effort, but you can spin up another virtual machine to run your database.

Will Vincent  36:21  

It's a big complex thing. And as you as you mentioned, you know, Postgres so you often want to, you'll want to use a production database. So Django comes with SQL lite, by default, which is file based, but you will want to use MySQL or Postgres typically. And it's better to use that locally to match which in production which you can set up or you can use Docker. So this is the topic of my forthcoming book. I'm getting into all this, but this is another gotcha for people. How do I, how do I install a production database locally? How do I install you know if you use something like Redis and then I'm in a team setting? How do I do that? You know, the answer for many people is use Docker and Docker. Especially. But Docker is a beast of a program. It is deep topic. So you know, there's just levels for all this. And I think people just internalize it and forget how much there is to learn. And for a beginner, you really want them to build websites and have that feeling of deploying, getting something out there. It doesn't have to be perfect, but then have a sense of what is the roadmap of things that you add on? Right? So do it in a linear fashion. That's a long term goal of mine. And the problem is that a web framework like Django is really at the top of that pyramid of skills that I mentioned,

Carlton Gibson  37:33  

he suddenly won't pop. It's one part of the month.

Will Vincent  37:36  

Yeah, it's funny, like, you know, it presumes knowledge of all the other areas. You know, I mean, databases, we do an entire lot, you can specialize in databases. But with a lot of this

Carlton Gibson  37:46  

stuff can specialize in deployments. Right? You can specialize in cloud infrastructures, so you can make sure that the virtual machines are in place such that you can deploy your Docker application or Yeah, whatever it is.

Will Vincent  38:02  

Alright. So, communities so the Django learning Django communities, these are a little bit spread out, I would say there is, again, I think most people aren't aware of that there's a Google group for users that we'll link to. That's quite active. There's subreddits on it. There. What else is there? You know, there isn't stack Stack Overflow, Stack Overflow, more of like an intermediate level. I would say Stack Overflow.

Carlton Gibson  38:28  

depends on your question. You've got to ask a good question. Any of these places like if you email the chango users Google group, you've got to try and explain your problems so that someone can help you. Yeah. People do I can't deploy an application will tell me something and then maybe I can help you. Yeah.

Will Vincent  38:45  

And there's Vito who writes simple is better than complex. He set up a discourse board that will link to that is pretty active. There's just a lot of different communities. I guess. It'd be nice if there were one canonical place but That's not, that's not where we're at. You know, and I would say if you're going if you're learning, you know, StackOverflow is fantastic. It is famously not always friendly. So if you get snide remarks, you know, that comes from people who are experienced, too. They are donating their time to teach, but they're just tired of the empathy is a little bit lacking for total beginners. So, you know, maybe look at some of these other places there plenty of friendly people out there. There's Django girls does regular conferences, and there's a whole host of meetups provided a link to that as well. Which those are fantastic. I mean, here in Boston, there's almost every month there's one that I've spoken out that is a wide range of people and you know, those I think it helps to just see the people behind it and see that they're normal people with different backgrounds and and using Django in many different ways to which is interesting. It's not it's not just Instagram or something. It's used in so many ways these days.

Carlton Gibson  39:53  

Yeah. I guess for me, the moral is just to just to keep going, just just take it slow and keep going and you You know, if you get stuck, that's fine. Be you know, everybody gets stuck, everybody.

Will Vincent  40:05  

Yes. You and I get stuck every day, just a different level of

Carlton Gibson  40:09  

a thing. You know, I like three, three hours. I'm very defeated. I'm giving up programming. Oh, there's a typo.

Will Vincent  40:14  

Yeah, it Yeah. And that's a very true thing. And I I've had that discussion with most of my friends are not programmers that's unusual as a discipline that that is truly the reality that every day, we are pushing the envelope of what we know and you we largely automate what we don't know. And so, you know, that lends to this imposter syndrome where it's not like Jiro making sushi, you know, programming is solved one problem move on, especially web development is very, very wide swath of things, which makes it incredibly interesting. But there are times when I You and I both think, I don't even know anything or you know, why am I struggling with this thing, right, like, and over time, what I found is I sort of know, I know that I can figure anything out. And I know that I've probably already figured out in the past so even if I don't know, off the top my head, I have a vague sense of well, this fits to this and that and the sort of the confidence that I can plow through it. I mean, because that's the other big thing for beginners when I was just last week teaching a bunch of newcomers how to build a static site. People just give up easily. I think we should get older you get out of the learners mindset, because it's, it's painful, and it sucks and you feel stupid. And then as programming you just build up a tolerance over time. You know, I tell people I'm like, how you feel. That's how I feel every day for hours of my day.

Carlton Gibson  41:35  

And for me, that's it. The fun bit of programming is like it's a it's a job. It's worth Yeah, where you get to be, you get paid to solve logic problem.

Will Vincent  41:46  

Yes. You get paid to learn. It's never boring. Well, fairly boring.

Carlton Gibson  41:49  

They're hard. Yeah. And that's why it's worthwhile that you get paid. But ultimately, there are people who spend their weekends doing Sudoku. Yeah, right, which is the same question. Mental stimulus, but it's just a game, whereas programming is building something real. And it's like, wow, that's that can be a job.

Will Vincent  42:08  

Yeah, well, that's a good aptitude test if someone is, you know, curious would programming be for me if you are the type that solves Sudoku or crossword puzzles, or Yeah,

Carlton Gibson  42:17  

or anything in that whole rabbit hole

Will Vincent  42:19  

realm, which is not everyone does. But you know, then you have the type of mind that you will really enjoy. programming, especially web development and loved web development is really a liberal art. It's such a broad array of things that you need to do and bounce between that I think if it was typed properly, people would see how, how vast and interesting it is. It's not a narrow thing at all.

Carlton Gibson  42:41  

Well, it's like writing or printing or you know, it's it's the publication medium of today. And you can it's it involves images and involves sound, and it involves video and it involves writing and graphic design and colors and fonts.

Will Vincent  42:56  

Yeah. And it's everywhere. I mean, if you look at the world You know, we both work with some companies and clients, there's so many opportunities to digitize, still almost every space. And the technology pieces, you know, not the challenge, but you can replace paper and pencil, you can, you know, three ring binders, and you can just, there's so many systems around the world that can be radically improved. So with programming, you know, I tell I think that it's better to know a little bit of programming in Django, and also have some domain expertise. That's a real sweet spot, then you're a superstar. It's just, you know, because there's so many, you know, I'm thinking of medical because I work in I live in Boston has a whole bunch of medical related things, you know, you but this one

Unknown Speaker  43:41  

wouldn't, because in every office,

Will Vincent  43:43  

every every Yeah, every office

Carlton Gibson  43:44  

every if you're an office work. Yeah. And you can also do like a basic blog application in Django and like, if you've gone through those three tutorials we talked about, and you know those, so you're competent. You are massively valuable in that office. Because you can produce applications.

Will Vincent  44:02  

Yeah, which they can't afford to bring in a paid consultant bill, but they would really make a difference to the productivity of that team, right? And the management team often doesn't have the vocabulary to even have it. So it's it's an irony that often it's the lowest paid or valued person in a company who's in charge of the WordPress site or something. Right, who takes on the tech. And so I guess I would encourage people try to make the leap from WordPress to a web framework, you know, especially like Django because it is a bit of a leap, but the power that you have is so much better and WordPress, you know, I find WordPress overwhelming,

Carlton Gibson  44:38  

frankly. Yeah. And if it you know, if that's the move you make from you running the WordPress website, and then you learn something like Django, all of a sudden, you know, Python. Yeah. And then from Python, you can do data, data analysis stuff. So you can go, Oh, you know, I need I'm really struggling in Excel. Well, let's just pull it into Python. And let's do the stats in Python using the some library that you download up Wow, brilliant, you can do that. And you could do automation all of a sudden, you know, little scripts which make your life easier. And all of a sudden you've got these superpowers.

Will Vincent  45:07  

Yeah, yeah, no. And then you look at the whole world differently because you things that are frustrating, you say, Well, I can automate that. Or you can say, I can solve it. You know, I can be an entrepreneur, I don't have to be frustrated with something I can build something to to change it. And that's, that's the best way to do it. Yeah, there's Africa's opportunity. That's

Carlton Gibson  45:27  

what it's all about. That's what it's all

Will Vincent  45:28  

Yeah. Yeah. I mean, I see. Yeah. I mean, I dropped my daughter at preschool before this, you know, there are things there that are such a waste of time for talented teachers to have to do that. Could and will at some point, be automated. And it just lets people be better at whatever they do, generally. So it's, it's an exciting time to learn web stuff, I guess is the point. Yeah. Yeah. All right. Well, we've talked on this wrap

Carlton Gibson  45:51  

up that's wrapped up, you know, we can finish on a better point than

Will Vincent  45:55  

Yeah. All right, everyone. Thanks for listening. You can find all this episode and others at gencon and also on Twitter at chat Django. We'll see you next time. Join us next time. Bye bye