Transcript: How to Learn Django (Ep2 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
the challenge with 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 think you know with python some people
get excited about you know doing the fibonacci sequence or you know calculating prime numbers
and that's like the computer science types and god bless them but most people don't care about
that they don't get a thrill out of outputting stuff to the command line they want to build
something real and so i agree django is a good way to use python in a practical way you know i see
i've had this debate with other people because there's more you know people typically with a
computer science degree who say, I think it's even, what's his name? Jeff, Jeff Knupp 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 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 if your application gets any traffic which most applications won't because they're in
their corporate internal things or whatever yeah but that's like telling someone their baby is
ugly i mean they hear it they don't hear it yeah but you don't need you don't need to know about
you know even select related usage in the in the orm or any of these advanced topics until
your application has a problem yeah i agree it's it's the step-by-step sequence and the best way
is to feel the problem to learn it.
You know, what you said about university,
I want to add, you know,
I think one of the reasons
why computer science scares a lot of people
is because so many people come in
with years of programming experience
and, okay, they don't know data structures,
but, you know, maybe they've built sites with PHP
or something else for years.
And so, you know, half the class has that background
and half the class maybe is just taking it
for the first time and they just feel stupid
because 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 already has years of experience on you.
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. But that's a separate discussion we can have.
Yeah, I mean, for me, I think the computer science stuff comes, okay, it's great. 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 be performance problems and all sorts, but deal with those later on.
Yeah, learn by doing, for sure. 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, 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 recommend dropping down a level and saying, you know, Django Girls has a great tutorial.
I've got a bunch of great tutorials on my personal site, you know, Django for Beginners.
So I think that's a good way to level set.
But, you know, I tell people that tutorial is not for total beginners.
Yeah, it's like on the Python website, the Python tutorial.
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 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 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 not interesting for me to write, but you lose so many people right off the bat
when you just jump in.
You know, and I'll give an example. The Django documentation, I don't think mentions virtual environments anywhere. So I'm pretty sure if it does now, it didn't in the past. So, you know, which 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, 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 um 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, you know, because we, you know, as a professional, you sort of set it up and you forget about it or you internalize how hard it is to set up.
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 years of doing that over and over and over again.
you forget that you, you, you tell yourself that that didn't exist or something because it was so
scarring, but 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 three and watch what happens. I mean, I just had that somewhat recently
someone, um, I work at a coworking 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. And yet that's what students, you know,
people in the real world will jump in and do. So there's a disconnect there.
But that's always the disconnect between academia and industry, right? In every field.
But it doesn't have to be like that. But yeah.
Well, maybe. Ivory Towers. Anyway, we'll save the philosophy for a different time.
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, a view, a URL, and a template for, you know, for your average page. And so
that's, you know, four things for one page. The order doesn't really matter. You kind of need
them all at once. So that's a big stumbling block I see with people is they'll say, well,
you know, what 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 your take is on that.
Yeah, no, I mean, I almost always start with the model.
So I create a model.
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.
If I want to create a list view, what would the URL be for that?
And it kind of goes together.
And then I might create a REST framework serializer or a form that goes around it.
because I'm thinking about the fields
and what type of data that 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 it.
And then, okay, I'll create the view.
Yeah, that's true.
That's true.
Well, in serializers, we'll do a separate thing
on how to learn Django REST framework
because it's basically all about serializers.
But that'll be a separate thing.
But I agree.
I mean, you start with the model,
think about the URLs,
and then admin but it's just something you just need reps you just need to build a bunch of sites
and you know it's sort of 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 well okay here's so quite often in um freelancing contracting work in agency
work you get given a very rich um comp like a photoshop comp of what the site's to look like
and so you start with templates yeah and then it's like well what are they 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 i think yeah it's not their skill set i think that's and so you have to
extract those in that sense. Yeah, 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 of form pages where they accept input and but yeah in the same way that yeah with
time you just see you see that every site is you know 90 95 exactly the same which is why you have
frameworks but you also the idea of crud create read update delete that every website has basically
the same functionality you know people don't also don't understand that at first and it takes a while
to say look it's it's all crud and it's some sort of form it's kind of it um but you know so that's
one thing i do with people is i say you know i'll say look i'm gonna tell you that all these popular
sites are basically the same if you're going to prototype them facebook twitter pinterest and
then I'll walk through the models and just say, look, this is how you do it. Maybe you have a
foreign key. Maybe you go crazy and you have a many to many with comments on Twitter. But that's
it. But I think people need to have someone break it down for them. Because once you get into the
details, 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 know what you're
doing you know so if you think you're being special i would really think again because
chances are you're complicating something that's already been solved and there's a more elegant
way to do it because again nobody cares how complex your code is yeah no it's that classic
line as well as 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
yeah 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
those that kind of thing like the password reset views class base etc like these kind of views yeah
um for me that the idea of a function-based view like it's it's cleaner it's what it's not cleaner
by the time you're doing yeah it's 20 lines long it's not it's too much to read yeah but if it's
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 yeah at which point is it
simpler there's a package to mention here as well called django vanilla views which it introduces
class-based views but they're they're a much simpler structure than the ones django um chips
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 there's also classy class-based views which will link to that's the
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 um 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 um 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 um variables and so that's much cleaner but get
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
terms of being consistent there there is no web framework out there which is totally simple and
totally obvious because the 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 it yeah let's see um 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 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 AllAuth,
but Django, there isn't just a...
You have to write those yourself,
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, it has legacy reasons, and we'll talk at some point.
Right now, you can just use the built-in user model.
You can also do a profiles approach, which you use.
This is what I do.
So I use this.
So you can create a custom user model, but it's a lot of work, and it opens 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 well 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 Contribault's user model and then create a profile model with a one-to-one link for additional fields.
I've been through this and I've come out the other side
and I go with the old school way and I like it
and I could just be too old now and I get off my laurels.
No, I see it both ways.
I mean, I wouldn't say it's right or wrong.
You're always going to need extra fields as an actual user.
Yeah, you're going to have to do one or the other.
For me, at that point where inspiration is perishable
and at 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
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 curve 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 podcasts 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 right 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 DigitalOcean,
Rackspace, Linode.
Do they do platform as a service?
No, no, no. I'm sorry. I'm just saying
it's not a platform
as a service, but if you wanted to do a deployment
you could control it.
So then it's either put it in a
virtual machine or
dockerize it if you can do that.
Do you agree with those three levels? Because I think it's
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 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 yeah it's it's a big complex thing and as you as you mentioned you know postgres
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
and it's better to use that locally
to match which is in production
which you can set up or you can use Docker
so this is a 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? The answer for many people is use Docker. And Docker is powerful, but Docker is
a beast of a program. It is a deep topic. So 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 it's but it's like you know but it presumes knowledge
of all the other areas you know i mean databases we do an entire what you can specialize in
databases um but with a lot of this stuff you can specialize in deployments right you can like
You 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.
So the Learning Django communities, these are a little bit spread out, I would say.
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, 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 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
or, 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 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 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.
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. 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 wouldn't be because in every office.
every office 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 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,
You know, I find WordPress overwhelming, frankly.
Yeah, but, you know, if that's the move you make from you running the WordPress website
and then you learn something like Django, all of a sudden you know Python.
Yeah.
And then from Python you can do data analysis stuff.
So you can go, oh, you know, 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 can 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 things that are frustrating, you say, well, I can automate that.
Or you can say, I can solve it.
You know, I can be an entrepreneur.
I don't have to be frustrated with something.
I can build something to change it.
And that's the best way to do it.
Yeah, there's opportunities.
For me, that's what it's all about.
That's what it's all about.
Yeah, I mean, I see.
Yeah, I mean, I dropped my daughter at preschool before this.
know there are things there that are such a waste of time for talented teachers to have to do that
could and will at some point be automated and it just lets people be better at whatever they do
generally so it's 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
all right join us next time bye