Transcript: How to Learn Django
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 view is 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.
I see what's going on.
It's a good learning path there.
Yeah, well, there's also classy class-based views
which will lead 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 uh do what two scoops of
jango book advocates which is having a local a dev and a production um 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
um variables and so that's much cleaner but 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 just 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 i'll link 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 there is no web
framework out there which is totally simple and totally obvious because the 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 yeah let's see um another
big one with web development 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 um you have a lot of um flexibility but you for
example you have to do your own sign up uh view and form you can use a third-party package like
There's a bunch of them, Django all off, but Django, there isn't just a, you have to write those yourself, which, 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, 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 which you use, this 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 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 yeah and then i can store whatever other fields i want on the on the profile model and that
works and do you do it was 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 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 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 um and it became you know it was something that was bought in for that reason i think it was
a user in mind yeah well there's so we'll um 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 um i'll link to those
because that's another gotcha um 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 um the
um auth user model setting before you've run migrate and if you don't do that you have to
start again because yeah so if you don't if you don't set this up before you run your first migrate
command um you uh 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
um so it's it's it's possible to do with with profiles it's possible to do a custom user model
and just a few lines of code um but it's um a complex topic and yeah and like this is one
reason why i like the 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 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.
But it's, you know, I feel like it should probably be, what do you think as Django fellow about that?
Well, I'm just thinking, I'm thinking about it as you speak.
Yeah, you could create a template.
What I actually think is just use Contriborth's user model and then create a profile model with a one-to-one link for additional fields.
I've been through this and that 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 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 you're always going to need extra fields it's actually user yeah 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 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 its own 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 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 um so you know there's
just levels for all this and um 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.
Stack Overflow, 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.
People do, 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.
You know, and I would say, again, if you're learning, you know, Stack Overflow is fantastic.
It is famously not always friendly.
So if you get snide remarks, you know, 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, you know, 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 and using Django in many different
ways too which is interesting it's not it's not just Instagram or something it's it's used in
so many ways these days yeah i guess for me that the the moral is just to just to keep going just
take it slow and keep going and you know if you get stuck that's fine be you know everybody gets
stuck everybody yes you and i get stuck every day just a different level of things you know
like three three hours i'm very defeated i'm giving up programming oh there's a typo yeah
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 um 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 solve one problem move on 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? 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
it's painful and it it sucks and you you feel stupid and then as a programmer you just build
up a tolerance over time you know i i tell people i'm like how you feel that's how i feel every day
for hours of my day and for me that's the fun bit of programming is like it's a it's it's a job
it's work where you get to be 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 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 kind of 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 yeah well and 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 or anything in that whole realm that whole realm which is not everyone
does but you know then you have the type of mind that you'll really enjoy um 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 um that i think if it was taught properly people would see
how how vast and interesting it is it's not a narrow thing at all 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 it involves sound and it involves video and it involves writing and graphic design
and colors and fonts yeah and it's it's everywhere i mean if you look at the world um 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, 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 if it's just you know because uh there's
so many you know i'm thinking of medical because i i work in i live in boston there's a whole bunch
of medical related things you know you but this work wouldn't because in every office every every
yeah every office if you're an office worker 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
yeah 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 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 um 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 frankly yeah and
but you know 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 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 oh 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 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 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
to have to do that could and will at some point be automated um 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 yeah let's wrap 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 django chat.com and also on twitter at chat django
we'll see you next time join us next time bye