Django is the most popular and most mature Python web development framework around. It makes it easy to build better Web apps more quickly and with less code. Building web sites with Django is not just smart and efficient, but fun too! In this course, Django Fundamentals, you will learn how to build a complete web application with Django. First, you'll see how to create attractively styled pages using Django templates. Next, you'll learn how to add URL mappings for these pages, and handle user interaction with forms. Finally, to store and manipulate data, Django offers a powerful model API and admin interface, and of course these are covered as well. After finishing the course, you will have a good overview of all the essential parts of Django and how they work together, so that you can go on and build your own websites in Django.
After years of working in software development, Reindert-Jan Ekker has
decided to pursue another passion of his: education. He currently
works as a college professor of Computer Science in the Netherlands,
teaching many subjects like web development, algorithms and data
structures and Scrum.
Course Overview Hi everyone! My name is Reindert-Jan Ekker, and welcome to my course, Django Fundamentals. I'm a senior developer and educator. And in this course, I'll teach you about Django, the web framework for perfectionists. Django is the most popular web framework for Python. And it's awesome to work with. In this course, we're going to build a web application with Django. And along the way, you will learn about all its major components. We'll cover templates and URL mappings, the Django model API, and the admin site, using HTML forms for user input and validating that input, user authentication and login, and much, much more. By the end of this course, you'll have a firm understanding of all of that and how it works together. And you'll be ready to become a Django developer and create your first website with Django. I hope you'll join me on this journey to learn Django with the Django Fundamentals course at Pluralsight.
Introduction Hi! This is Reindert-Jan Ekker, and welcome to this course about the fundamentals of web development with Django. In this module, I'll tell you a bit about what Django is and what you need to know to be able to follow this course. I'll also tell you what you can expect from this course. In this introduction, I'll start by talking about Django itself, what it is, and why you might choose it as your web development framework, and the design principles it was built upon. Then we'll talk about the prerequisites for this course, what you should already know to be able to follow the course, what to install, and which versions of Python and Django I'm going to cover. After that, I'll show you a demo of the project we'll build, and I'll give you an overview of the modules in the course.
Installing Django Hi! I'm Reindert-Jan Ekker, and in this module, you'll learn how to correctly install Django on your system. In this module, we'll install Django. Before we can do that, you have to make sure that you have a Python installation. I will not cover that in this course, but I will give you a point or two, of course, that tells you how to do this. When that's out of the way, we'll see how to set up a Python project by creating a so-called virtual environment. And inside that environment, we will then install Django. Once we have Django on our system, we can start a Django project, but I'll cover that in the next module.
Starting a Django Project Hi! In this module, we'll start a new Django project and make our first simple web application. We'll start with creating a new Django project, running it, and setting up the PyCharm editor to work with the project. We'll take a short look at the projects, and we'll also add a simple page to the app to get a better feeling of how Django works. The component we need to add for that is called a view, and we'll have to add a URL mapping to determine at which URL this page is shown. For now, we'll keep it simple. But, of course, later in the course, we'll see how to create proper HTML pages with templates, fill the content of the page from the database using a model, and add styling with CSS. But let's start small.
The Admin Site and the Model API Hi, and welcome to this module. Django offers a really nice way to work with the data called the admin site. We'll use it to create some data, and then we'll see how to manipulate the data from our Python code. So what is the Django admin site exactly? Well from the model classes we've just written, Django can generate a very powerful user interface to add and edit data. This is a feature that can seriously boost productivity since it means you won't have to write the user interface yourself. It also means that while you're still writing code for your project, other project members can already start filling the database. They won't have to wait for you to write input forms and things like that since you get that for free because it comes with Django by default. Before we can use the admin site, though, we need to register our models. So, of course, I'll show you how to do that, as well as adding a super user so we can log in. Now the admin site is very customizable, and you can make it behave in lots of different ways. So you can make it fit your workflow quite easily again boosting productivity for whoever is managing your data. After seeing how we can use the admin site with our models, we'll take some time to look into the model API, which lets us retrieve our data from our database and work with it all from our Python code. We'll learn how to query our database to find the objects we need, do essential operations like save, update, and delete, and we'll see what relations which are represented by foreign keys in the database look like from the Python side.
Forms and Authentication Hi! In this module, we'll learn how to ask the user for input and process that. We'll write our own forms, but we'll start by using some components that Django provides for logging in and out. We're going to start this module by implementing authentication. For that, we'll use the logging components that are built in to Django, the LoginView and LogoutView. For the LoginView, we will need to write a template that shows the login form to the user. We'll also see how to restrict access to a view to only logged-in users and how to redirect a user to a different page. To make all of this work, we need to give our URLs a name. Then we'll move on to another set of features. We'll enable users to send each other invitations. We'll need to create an HTML form ourselves, but we will use a so-called Django ModelForm to help us with that. We're going to write code to show the form to the user and handle the user data after it's been submitted. We'll also need to validate the user input and show error messages, and we'll style the form to make it look nice. At some point, we'll need to write a view that shows just a specific invitation, and we'll need to learn how to write views that take an argument so we can tell it which invitation to show. Right! Let's get to it!
Making Moves Hi, and welcome to this eighth and final module in which we'll add move making and finish our application. We'll start by adding the final piece of functionality to our application, and that's making moves. This primarily means that we need to implement a game detail page, and for that we will revisit a lot of things we've seen before. We'll also learn some new things like how to give a model instance its own so-called absolute URL, two new template features--block. super and template includes. We'll do some custom validation when the user enters a move. And I'll talk about a best practice called fat models. Then at the end of the module, we'll take a look at class-based views and see how to use some of those that are provided by Django.