What is Django?
A free video tutorial from Brad Traversy
Full Stack Web Developer & Instructor at Traversy Media
4.7 instructor rating • 15 courses • 263,113 students
Learn more from the full coursePython Django Dev To Deployment
Learn Python and build & deploy a real estate application using the Django framework & PostgreSQL
11:05:55 of on-demand video • Updated October 2018
- Learn Python and it's core fundamental syntax
- Build a real estate application using the Django framework & Postgres
- Learn about apps, templates, models & migrations, admin customization & more
- Build virtual environments and deploy using Gunicorn and Nginx
English [Auto] You guys before we get started on the course and setting up I just want to talk a little bit about what Django is. I also have a list of links and resources that I'm going to attach to to this lecture including Django cheat sheet and some deployment instructions and you know links to the official documentation all that stuff. So Django is a high level Python framework as you can see it says right here. So Python is a very popular general purpose language it's use for just about anything really including web development building utilities automation machine learning data analysis it's use first in so many different areas and it's really blowing up now. And Python has has a few web frameworks but there's two really popular ones really good ones and that's Django and flask. OK and they're both very good but they're both very different. Flask is very low level so I won't explain the difference between high level and low level with a low level framework like flask. You don't really have a specific way of doing things. You can set up your application structure however you want. And in fact you could probably put everything in one file if you wanted to. You have very few baked tools and features. It's basically just a micro framework so it provides some basic structure and some some little bells and whistles to help you help you along rather than building it from scratch. OK and that can be a good thing because it gives you a lot of freedom. However it also gives you a lot of room for error. So with Django where it's very high level you have a really specific way to structure your files and to write your code and there's very little room to mess up. So I think it's it's really good for beginners. I think it's easy to learn and not only that it offers really fast development because you have command line tools for creating your projects creating apps within your project which I'll get into. I'll get to in a minute. Migrating data. So so creating your database tables and things like that. So Django was very fast. When it comes to creating creating web sites and applications it's also very secure it has a lot of built in security features. It has authentication it has an entire admin area available to you which you can customize. So there's a lot to it and I'm a very practical developer so I like tools that get the job done quickly. I get it done right but also quickly and this comes from my years of running my own business and freelancing. And Django is one of those tools that allow you to build something in a month that would take you maybe three months using another framework or even you know six months to a year. Building it from scratch. So that's why I am a huge fan of this framework. It's also very scalable so you can build really big applications with it. Now as far as databases you can use pretty much any database you want. We'll be using post-grads which is an extremely powerful relational database. You could also use my skew Well Eskew light is the default but I wouldn't recommend using that in production it's more for testing or maybe really small apps but you could also use something like Mongo D-B So there's really no limit to you know the database the type of database that you can use. Now the last thing I want to talk about is the concept of apps and I'm not going to show you any fancy diagrams or anything like that I'm going to show you hands on but I just want to give you a quick overview so Gengel has the idea of a project which is your Web site as a whole your whole web site or your whole application is your project. And then inside that project you have what are called apps. So if you have let's say a blog on your Web site your blog would be an individual app that has its own model its own view its own you or else file things like that. If you have a store where you sell things that store would be another app and that would have its own folder. So each piece of functionality on your website you create what's called an app. Ok even first static pages like what we're going to do we're going to have a page's app to handle static pages. So that's what I mean when I say that Django has a very specific way of doing things. And once you learn those ways you'll be able to build your own projects very easily and not spend so much time trying to figure things out and debugging because there's you know there's little There's very little wiggle room to mess up. Now before we get into the next section I just want to show you a couple of resources and I'm going to include a text file with this with this lecture that has links to this stuff along with some other things. But this is a cheat sheet that I created and it basically has all the different commands to for instance install Django how to create your project how to create apps within your project run your server all that stuff. It also shows you how to create a virtual environment it you definitely want to create an individual virtual environment for all of your different Django applications. So it shows you how to do that. Then we have this just here which is on deployment so we'll use this in the last section and it shows you how to create S-sh keys and add them to digital ocean how to set up a simple firewall do some security stuff install everything set up post-grads create a local settings files so you don't share your database information and all that stuff with the world and then set up a unicorn and engine X. All right and of course you can deploy any way you want if you want to use docker. You can do that if you want to put everything in containers. Obviously I'm I'm not going to do that in this course because that's a whole new can of worms. That's a whole nother technology. But if you if you find that you want to do things differently along the way that's absolutely fine. You don't have to follow everything to a tee. It's completely up to you. All right so in the next section we're going to start from absolute scratch and get Python installed and I'm going to do it. I'll show you how to do it on Mac and in Windows.