#100DaysOfWeb in Python Transcripts
Chapter: Days 45-48: Build a simple Django app
Lecture: Django starter and architecture

Login or purchase this course to watch this video and the rest of the course contents.
0:02 The Django starter, here's the Django homepage
0:05 and it gives a nice overview
0:07 what's awesome about Django, I like to quote at the top.
0:11 Django was invented to meet fast moving newsroom deadlines
0:15 while satisfying the tough requirements of web developers.
0:19 That's true, although there's quite
0:21 a bit to it to learn Django to get started.
0:25 Once you know those basics, it becomes relatively easy
0:28 and fast to build robust apps
0:31 with clean code and good structure.
0:34 It's fast, it's fully loaded comes with batteries includes
0:38 just like they say about Python and the Standard Library.
0:41 It has security builtin, so SQL injection, Clickjacking
0:45 Cross-site Request Forgery, all that stuff is covered.
0:48 I mean, you don't want to imagine even having to
0:51 write your own code for those things.
0:53 First of all, you might not even know how to
0:56 second of all, that's the stuff
0:57 you don't want to worry about.
0:58 You want to build your awesome app. It's scalable
1:01 which is important, because you're awesome app gets popular
1:05 you need to handle more traffic.
1:07 Scalable also see in terms of the structure of Django
1:11 Django has a project and inside it has apps
1:14 for example, for the code challenge 52, the other day
1:17 I made an app in one Django project
1:20 and I could easily move it over
1:22 to another Django project which is great.
1:25 A little bit on Django's architecture.
1:28 This might seem complex, and at first sight it is.
1:31 But as we start building our Quotes app, this will start
1:34 to make a lot of sense and basically comes down to a client
1:38 or web browser, making a request
1:40 to the web server where our Django app runs.
1:43 The Django project has one or more apps
1:45 and every app has a URL router
1:48 that routes the request into the view.
1:51 The view then has one or more functions
1:54 or classes that handles the request
1:56 which commonly interacts with the database
1:59 or Django's ORM and then sends a response back
2:02 to the browser, which includes the template
2:04 and the data that was retrieved from the database.
2:08 That's basically all there is to it.
2:10 But again, we will see this in more detail later.
2:13 With this design, Django follows the MVT design better
2:18 closer to rated MVC, Model-View-Controller
2:21 or in Django's case, MVT, Model-View-Template.
2:25 Lastly, how does this differ from other frameworks like
2:29 Flask? As you see here, Django comes with batteries included.
2:33 Django has its own ORM, it's templating engine.
2:36 You get it all out of the box.
2:38 Flask on the other hand is bare bones
2:41 you can't get a hello world at working
2:43 with seven lines of code.
2:45 But then for templates and databases, you're on your own
2:48 which gives of course, great flexibility
2:51 you can use the ORM of your choice
2:53 as well as the template engine.
2:55 Django forces you to do it the Django way.
2:57 Its own ORM and templating, which I like.
3:01 But some people say I don't really like that.
3:03 So I take Flask and build my own
3:05 or use the components of my choice.
3:07 Flask in that sense is called a micro-framework.
3:10 It's easier to get started with but when you need to grow
3:13 to more complex applications
3:14 you have to rely on plugins and more customized design.
3:18 Django might have a steeper learning curve
3:20 because as you see here on the diagram
3:22 there's a lot of moving pieces.
3:24 But once you get that down, you can do it all in Django
3:27 and you should be fully covered.
3:29 I hope that gives you an idea
3:30 of how Djangos architecture works.
3:32 But of course we have a lot more explaining to do
3:35 and by building a Quotes app
3:36 you're going to see these pieces one by one.
3:38 So let's see next what we are going to build.