← Back to Show Notes

Transcript: How to Learn Django (Replay)

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

will how do you learn django 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 um i think

So 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 in 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 what do you think about that carl

then i think that's probably the biggest one is how much python do you need to know before you

jump into django well python could be like assuming you know a bit of html and css so you

can build a basic web page right if you know that much then you could actually learn the the dynamic

the programming bit the python bit by just getting started with django um yes i completely agree

you wouldn't understand anything but yeah it's a go through some tutorials you could copy and

paste a 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 together but you could literally go from knowing

nothing and django would be a great way into python if you if you didn't i agree because i

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 people typically with a computer science degree who say I think it's even what's his name?

Jeff Nupp 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 going to learn bad 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.

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 a 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 it doesn't sink in or you don't get it yeah and like 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 tree or any of those things but they already were computer

literate when somebody coming to to programming from the real world they they've got a job to do

so 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 ORM

and that's a nice way in.

And yeah, later on, you'll need to know about indexes

and about joins and about how you can optimize queries

because if your application gets any traffic,

which most applications won't

because they're corporate internal things or whatever.

Yeah, but that's like telling someone their baby is ugly.

I mean, they hear it and they don't hear it.

Yeah, but you don't need to know about, you know, even select related usage in the ORM

or any of these advanced topics until your application has a problem.

Yeah, I agree.

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've built sites with PHP or something else for years. And so, you know, half the class

has that background, half the class maybe is 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

in experience, right? You don't have that with organic chemistry in the same way. So, you know,

that's a separate pedagogical thing. But I think one of the reasons why computer science is really

scary is, 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, well, I'm stupid,

or i don't get it and that's really not the case um but that's a separate discussion we can have

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 that's 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 there'll there'll be performance problems and

all sorts but deal with those later on yeah learn by doing for sure what let's just start off what

are some of the good resources this is a good question for people how do you learn django i

mean my um 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, jump in the documentation, it's really

going to work for you. If it doesn't work for you. 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 um but you know i tell people don't that tutorial is not for total beginners yeah it's

like on the um 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 and the data model and what's unique about python but it's not a big

a python for beginners no 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 Pulse 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 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 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 um 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 django's 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

docs can't do everything for you. But I think that's the 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, try that, you

know, well, before that, install Python three, which is its own challenge, actually, that's a

huge stumbling block, which JavaScript doesn't have, 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 stuck yeah you can't even you can't even start i mean on my so my 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 you know 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 it beginners and how do i install it and what does it mean when it says

when it the box comes up and say would you like me to add this to path sorry what's path yeah

why is it all capital letters and like 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 um you know because we you know as a professional you sort of set up and you forget

about it or you you internalize how hard it is to set up but even forget you forget the 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 the years of doing that over and over and over again you forget that

you but you you tell yourself that that didn't exist or something because it was so scarring

but yeah yeah beginners have that experience every single time they try 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 3 and watch what happens i mean i just had that somewhat recently someone um 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.

Went to DjangoCon 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, create a 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, oh, some cryptic error message.

And he's like, oh, no.

So we sat there all lunchtime fixing that.

Yeah, well.

And we're experts.

Yeah, yeah.

Well, and that's, yeah, yeah, yeah.

Well, and that, you know, virtual environments, too.

I mean, there's pip, there's pipenv, there's venv.

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. So, you know, as, as experts, I don't care if it, you know, if I have a choice,

I like pipenv, but I don't care if it's pip. I don't care. You know, it doesn't matter to me.

It's whatever someone started the project uses, but as a beginner, just got to blast through that

stuff. Yeah. 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.

Right, well, and this is the pyramid.

As quickly as possible.

Right, when I think of this,

this is the pyramid of learning how to code

where the base is,

and it's just way more things than people think about it.

The base is 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.

I think about how to make that interesting for people.

I just taught something recently.

I taught over lunchtime a bunch of people how to build and deploy a website in an hour, which you can do.

And, you know, 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 and 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 the

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 um html css javascript so you know it's an unsolved problem but i it's a pyramid of

stuff like and you think how do you know we'll 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 yet it's like

people have ah cd what oh you know yeah 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 of my head i think it's in the book too actually i'll say like if you ever see this you

know to like sudo you know rf-rf star like do not do that um it's really a scary thing um anyway so

there's a lot to learn with django i think install python just jump right in and there are resources

to mention two tutorials you mentioned the django tutorial and the django girls tutorial the other

one that's very good is the django risk framework tutorial it's nice and simple it's nice and low

level uh you know relatively speaking it's equally low level as these other things but if you were to

if you were to go through those three tutorials and be able to do them you would know a lot

actually and you would be able to then build a web application 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 um which is why um you know so i actually i think i have a big i've

written a bunch of a 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 um in my awesome django 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 um woefully

underserved by educational content but it's i don't think it's better for other you know it's

that um barrier to entry to programming full stop like we're just we're just not a computer

literate culture 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 um i mean many of the readers of my book are undergraduate graduate students in computer

science at very good schools they just are never taught this yeah because it's all c and java and

stuff c and java and you know i i understand i mean you basically have to be an adjunct to teach

web stuff it changes so rapidly um and i 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 um 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 um 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 that's a separate that's a

separate discussion but it's a challenging thing because that's but 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 of course yeah absolutely i mean it's it's a good problem in

a way but it is a problem um that's a whole separate that's a whole massive skill short

yeah that's a whole separate discussion but i think it's economics or whatnot yeah but with

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 um and yet that's what students you know

people in the real world will jump in and do um so there's a disconnect there but that's always

the disconnect between academia and industry right in every every field but it doesn't have to be

like that but yeah well maybe i'm not yeah ivory towers 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 four 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 um 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 order do you do

them in. You 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 yeah no i mean i almost almost always um start with the model so

i you know i create a model these are this is what i want to save 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 these it kind of goes together and then i might

create a rest framework serializer or a a form that goes around it so because i'm thinking about

the the fields and what type of data the wants to save 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 yeah that's true that's true well and serializers

we'll we'll do a separate thing on how to learn django rest framework um because yeah okay uh

serial it's basically all about serializers but well that'll be a separate thing but i agree i

mean you start with the model um 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 you know same

thing with you know learning like react in particular it just at some point it clicks

and you sort of like oh why was that hard but that's a huge that's a huge one um 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 it 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

So quite often in freelancing, 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.

And then it's like, well, 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 a JSON schema or something, they wouldn't be able to give it to you.

Because it's not their skill set.

And so you have to extract those in that sense.

I think that's changing a bit.

But yeah, traditionally, that's the barriers of entry or 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 page you're going to have,

which is represented by generic class-based view.

You either are listing information, so you have a blog, you're listing all the blogs.

You have a detail 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?

Yeah, no, entirely.

I mean, you know, almost every, yeah, not every page,

but almost every page.

And like some are form pages where they accept input,

but yeah.

In the same way that, yeah, with time,

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 also don't understand that at first.

And it takes a while to say, look, 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 going to 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, the 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

like 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 yeah no there's that classic line as well

it's if it codes harder to to read than it is to write so yeah if it's if it's as complex code as

you can possibly write

then by definition you can't read it yeah you can't understand it later yeah well that and

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 challenge is 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

do the function-based views, but then you can, you know, more elegantly customize the generic

class-based view. But that's, you know, because when people are reading tutorials or they see

different things, 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 by the way the django the thing

with the django is built with class-based views internally almost entirely at this point

no yes yeah more than function i mean you know what's internal like the admin the source code

the source code if you go to if you want to get out and look at the source code it is mixins and

class-based views yeah i mean if you look at the auth views for instance that kind of thing like

like the password reset views, class-based, et cetera,

like these kind of views, yeah.

For me, the idea of a function-based view,

it's cleaner, it's not cleaner by the time you're doing

all these complex things.

Yeah, it's 20 lines long, it's too much to read.

Yeah, but 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,

at which point is it simpler?

There's a package to mention here as well

called Django Vanilla Views,

which introduces class-based views,

but they're a much simpler structure

than the ones Django ships itself.

And so they're like an alternate implementation

of the class-based views.

And what's nice about those is to play with them

and see the structure and you think,

oh, I see the logic.

And then if you map them back to Django's more powerful

but more complex class-based views,

it's like, oh, that makes sense.

Interesting.

I see what's going on.

It's a good learning path there.

Yeah, well, there's also classy class-based views

which we'll link to 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 the year index archive page it's like oh well

that's got like 40 methods and which where do they come from and what do they look like and

how which ones do i have to override to customize this yeah it's too much to internalize yeah it's

a super resource yeah so we'll link to that um you know another big one is um 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.

getting settings files in i'm sorry getting environment variables into your environment

when you run your app is actually yeah quite a skill right yeah it's not it's not true you know

for a big for a beginner to pick that up it's actually quite difficult so i agree yeah

separate separate settings files can be easy easier yeah i mean you should use one but um

well and you know the other one too is that django is customizable so like i have a post

all linked to about how to do a about page three different ways where you can put the view in the

url um 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 uh 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. There is no web framework out

there which is totally simple and totally obvious because the domain is difficult. It's not,

You know, you can only make things as simple as the domain itself.

It's a complex domain, and so there are lots of moving parts.

There's no way around it.

Yeah. Let's see.

Another big one with web development, and I think particularly with Django, is the user model.

So this is what you use for log in, log out, sign up.

In Django's case, you have a lot of flexibility, but you, for example, you have to do your own sign up 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, um, custom user model because, uh, that's a whole sort of mess. I would say, I mean,

I mean, I understand, you know, it has legacy reasons and I, you know, I'm, um, you know, we,

we'll talk at some point, you know, right now you can just use the built-in user model. You can also

do a profiles approach, um, which, which you use. This is what I do. So I use this. So like, um,

You can create a custom user model, but it's a lot of work and it opens up.

You end up, I've seen custom user models with 58 fields and you're like, well, this is meant just 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 minimal.

And then I can store whatever other fields I want on the profile model.

and that works and do you do it's very well and by the way and so for listeners the reason why

you would use a custom user model so you can update the signup form so instead of 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 yeah so the the way

you know if you wanted to store an age or something not in these gdpr days i'm not sure i

would but if you wanted to store an age you'd do it on a profile model which link or for 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 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 think 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, it was something that was brought in for that reason.

I think it was a user in mind.

Yeah.

Well, there's, so we'll, I don't know if there's a good profiles 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.

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 run migrate.

And if you don't do that, you have to start again because.

Yeah, so if you don't set this up before you run your first migrate command,

you're in a bad place because Django will automatically link up the admin in particular,

but other parts of your site with whatever user model is there.

So it's possible to do with profiles, it's possible to do a custom user model

and just a few lines of code, but it's a complex topic.

Yeah, and this is one reason why I like the profile model approach is that I can just start with the built-in user model, and I just start, and then later on 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, I mean, I agree.

I mean, I think about this a lot

when I write tutorials

because 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 wish that Django 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 um but it's i you know i feel like it should probably be what do you think as jango

fellow about that 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 um profile contrary both 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 i've come out the other side and i 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 then i get off my no i see i see i see it

both ways i mean i don't i don't i wouldn't say this it's right or wrong um you're always going

to need extra fields as actual user yeah you you have to you're going to have to do one or one or

the other i wish i for me when you at that point where inspiration is perishable and what that

start 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 part and that's the frustrating

thing for beginners is it'd be easier if there were or we could talk all day about which is the

right way to do user models and why i do it this way when you do it that way and but it doesn't

matter ultimately but when you're learning it's it's it's something else on the learning yeah

it's something else which makes it difficult an eject point um so i think the maybe the last big

topic is deployment well there's testing but that's a separate we'll do a separate thing on

that yeah yeah no testing with it definitely is so it's on deployments it's on podcast i 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 because it does i think it's 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 um i'll link to it there's a deployment checklist that i

would say most people don't know about um that you can run to see things like did you change

debug did you do a loud host a whole bunch of um settings that you would want to change for

production ready application um but really you have your options are platform as a service so

python anywhere heroku um i believe on replit you can do that too we should get them on the show to

talk about it um or google cloud platform yeah yeah and then your azure google cloud aws elastic

beanstalk and then step from there you have you know digital ocean rackspace linode um where you

do they do platform as a service no no i'm sorry i'm just saying then you're just um it's not a

platform as a service but if you wanted to do a deployment you could control it okay so then

it's either put it in a virtual machine or yeah dockerize it if you can do that but do you agree

with those three levels because i think it's you know like heroku python anywhere then you would

have google aws azure and then you would have um well okay so the virtual machines like the heroku

the because google have their app engine which is like a platform as a service same as heroku

and then azure have got app service and amazon have got um elastic beans it's like hosted runtime

yeah right so that's platform as a service i would call it and then beyond that you've got

just to compute so you've got like ec2 and virtual machines in azure and whatever google calls them

and that would be where 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 mysql instances which saves you a lot of effort but

you can spin up another virtual machine to run your database if you want to it's a big complex

thing and as you as you mentioned you know postgres um so you'll often want to you'll want

to use a production database so django comes with sqlite by default which is file based but you will

want to use mysql or postgres typically um and it's better to use that locally um 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 install a production

database locally? How do I install, you know, if you use something like Redis and then, oh,

I'm in a team setting, how do I do that? You know, the answer for many people is you use Docker

and Docker is powerful, 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. It's only one part. It's one part of the map.

Yeah, but it presumes knowledge of all the other areas.

I mean, databases, you can specialize in databases.

But with a lot of this stuff...

You 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 whatever it is.

All right, so communities.

But the learning Django communities, these are a little bit spread out, I would say.

There is, again, I think most people aren't aware that there's a Google group for users that we'll link to that's quite active.

There's subreddits on it.

What else is there?

You know, there isn't...

Stack Overflow is good.

More of like an intermediate level, I would say, Stack Overflow.

It depends on your question.

You've got to ask a good question in any of these places.

Like if you email the Django users Google group, you've got to try and explain your problem so that someone can help you.

I can't deploy my application.

Well, tell me something, and then maybe I can help you.

Yeah, and there's Vitor who writes Simple is Better Than Complex.

He set up a discourse board that we'll link to that is pretty active.

There's just a lot of different communities, I guess.

It would be nice if there were one canonical place, but that's not where we're at.

And I would say, again, if you're learning, Stack Overflow is fantastic.

It is famously not always friendly.

So if you get snide remarks, that comes from people who are experienced, who they are donating their time to teach, but they're just tired of the empathy is a little bit lacking for total beginners.

So maybe look to some of these other places.

There are plenty of friendly people out there.

There's Django Girls, does regular conferences, you know, there's a whole host of meetups, provide 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 at that is a wide range of people at.

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 using Django in many different ways too, which is interesting.

It's not, it's not just Instagram or something.

It's used in so many ways these days.

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

Yes. You and I get stuck every day. Just a different level of things.

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

Yeah, and that's a very true thing. I've had that discussion with most of my friends who are not programmers. That's unusual as a discipline. That is truly the reality that every day we are pushing the envelope of what we know and 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 solve one problem, move on. And especially web development is very, very wide swath of, of things, which makes it incredibly interesting. But, um, there are times when, right, you and I both think, I don't even know anything, you know, why am I struggling with this thing? Right? Like, um, 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 of my head, I have a vague sense of, well, this

fits to this and that.

And it is 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.

And I think as you get older, you get out of the learner's mindset because it's painful

and it sucks and you feel stupid.

And then as a programmer, you just build up a tolerance over time.

You know, I tell people, I'm like, how do you feel?

That's how I feel every day for hours of my day.

But for me, the fun bit of programming is like it's a job, it's work where you get paid to solve logic problems.

Yeah, you get paid to learn.

It's never boring.

Well, it's rarely boring.

They're hard.

And that's why it's worthwhile that you get paid.

But ultimately, there are people who spend their weekends doing Sudoku, which is the same kind of mental stimulus, but it's just a game, whereas programming is building something real, and it's like, wow, that can be a job.

Yeah, well, and that's a good aptitude test.

If someone is curious, would programming be for me?

If you are the type that solves Sudoku or crossword puzzles or anything in that whole realm, which not everyone does, but then you have the type of mind.

that you'll really enjoy programming,

especially web development.

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 taught properly,

people would see how vast and interesting it is.

It's not a narrow thing at all.

Well, it's like writing or printing

or it's the publication medium of today.

And it involves images and it involves sound

and it involves video and it involves writing

and graphic design and colors and fonts.

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 piece is, 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,

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.

If it's just because there's so many,

I'm thinking of medical

because I live in Boston.

There's a whole bunch

of medical related things.

But this work occurs in every office.

Every office.

Yeah, every office, everywhere.

If you're an office worker

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 which they can't afford to bring in a paid consultant to build, 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 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, especially like Django, because

it is a bit of a leap, but the power that you have is so much better. And WordPress,

I find WordPress overwhelming, frankly. Yeah. But if that's the move you make from

you're running the WordPress website, and then you learn something like Django,

all of a sudden, you know Python. And then from Python, you can do data analysis stuff. So you

can go, oh, I'm really struggling in Excel. Well, let's just pull it into Python, and let's do the

stats in Python using some library that you download. Ah, wow, brilliant. You can do that.

And you could do automation all of a sudden, little scripts which make your life easier.

And all of a sudden, you've got these superpowers.

Yeah, yeah. No, and then you look at the whole world differently, because things that are

frustrating you say well i can automate that um or you can say i can solve it you know i 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 um yeah there's opportunity that's what it's all about

that's what it's all about 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

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 um it's an exciting time to learn web stuff i guess is the

point yeah um yeah all right well we've talked on let's wrap up there because that's wrapped up

you know we couldn't finish on a better point than that yeah all right everyone thanks for

listening you can find all this episode and others at jango chat.com and also on twitter

at chat jango we'll see you next time join us next time bye