Both Django 1.7 and 1.8 contain large numbers of new features and changes. This course will take you through the most important ones to make sure you are up-to-date with this latest and greatest Django version.
The most important addition to Django 1.7 is the new Migrations Framework, which automatically generates database migrations. This will probably affect your daily workflow as a Django developer, and that's where we spend most of our time in this course discussing this new framework. Next we go into the new mechanism for loading apps, including the new app registry and the new AppConfig class. We also investigate the new System Check framework, some changes in the model API, and more. In Django 1.8, the ORM framework contains some powerful new features for implementing SQL expressions. The way we configure template engines has also changed, and Django now supports the Jinja template engine as well as the possibility of using multiple engines in a single project. We also look at changes in the TestCase class and the new Security middleware.
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.
Migrations Hi, my name is Reindert Ekker. As you may know, there's been two new versions of Django 1. 7 and 1. 8, and both contains a whole lot of changes and new features. In this short course, I'll take you through the most important ones. So, what can you expect from this course? I'll only explain the major changes in the new Django version. So if you're new to Django, you should first watch the fundamentals course and get some practice with Django before returning to this course and learning about newer versions. The introduction course covers Django 1. 6, but everything in it still applies to the newest version of Django. So, of course, that means that this course will not explain Django itself. It will assume you already know about it. Now, 1. 7 is a huge update, and the same is true for 1. 8 which is the new long-term release version. So the basic idea of this course is that I want to show you those things that will affect your daily life as a developer and point out some other things that you should at least know about. But there are so many minor changes that it's impossible for me to cover all of them. If you want a full list, you can always go to the Django release notes and see all of them. So let's get started with the Django 1. 7 which I'll tackle in three parts. I'll start with the database migration framework and this is a huge new part of Django and I'll take my time to show you how it works. Then I'll go into the new app loading mechanism and the AppConfig clause for configuring your app. This is not something you'll run into on a daily basis, but it's still good to know about. And then in the final part of the course, I'll briefly cover some miscellaneous changes. We'll look at the new form validation features, some changes in the model API, the new system check framework, and more. After that we'll go into Django 1. 8
App Loading In Django 1. 7, the general idea of what a Django app is has changed. And in this short module, we'll investigate what the new definition of an app is and how that affects us as developers. One of the general goals of the 1. 7 update is to make some of the inner workings of Django more clear and well-defined. One of these things is the idea of a Django app and how it's loaded. First of all, a Django app is now simply defined as a Python package used inside a Django project. So that means that the models. py module isn't required anymore, which used to be the case. Now as you know, we register an app for using our projects by adding its name to the Installed Apps setting. This will cause the app to be loaded, its models will be imported so you can use the Django rm functionality, etc, etc. So, this is pretty much the same as it used to be. But in Django 1. 7, there's something else that's new and that's that app where we added to a new feature called the App Registry. And I'll show you what we can do with that in a moment. Furthermore, you can now add an AppConfig class to your apps to configure them, which enables you to customize some behavior of the admin interface, the model layer, and more.
Models and Other Changes Let's have a quick look at what's new in the Models API and then we'll finish off with a short list of other changes that you should know about. And, of course, after that, we'll have three more modules about Django 1. 8. So, what are we going to do in this module? First, I'm going to show you what's new in the Model API in a demo. Then, I'm going to show you a very short demo of another new feature called the System Checks framework. Next, I'll take just a minute to talk about the new Form Validation features. And then there's a final slide that just shows some miscellaneous new other features.
Django 1.8: Intro and ORM So, now that we've covered all major changes in Django 1. 7 let's move on to the version after that which, of course, is Django 1. 8. Now, in this module, I'll give a short intro of the changes in 1. 8 that we'll be seeing, and then I'll start off with talking about the Django ORM. Just so you know, Django 1. 8 is the new, long-term support version. Basically, this means that any security fixes and important bug fixes will be applied for at least the next three years. The previous LTS version was 1. 4. Now, there's a large number of changes in Django 1. 8, and like with 1. 7, I'll only cover the major ones. And we'll do so in three parts. The first part we'll consider changes in the model layer. There's an interesting new feature there called SQL expressions, that makes working with models a bit more powerful. In the next module we'll take a look at the changes in the way Django handles templates. And the final part of the course I'll briefly cover some miscellaneous changes. We'll look at some new features concerning security, and some changes in the TestCase class.
Django 1.8: Template Engine Support The way template engines are configured and used has changed slightly in Django 1. 8 and in this module we'll explore what that means in practice. So basically what changed in Django 1. 8 is that there's now a stable API for calling a template backend. This makes several things easier and cleaner in the internals of Django but in every day development, we will mostly notice these changes in settings of py. The way we configure the template engine has changed and there are some new things we can do. If you're upgrading from a previous version, it's important to check this out because you should probably update your configuration. Now one of the changes is that Jinja, a very powerful template engine that some prefer over the Django template engine, is now supported out of the box by Django. Also, you can now configure multiple template engines to use in a single project.
Django 1.8: Miscellaneous Changes So here we are in the final module of this course, in which I'll quickly go over two other new features you should know about. A number of important security features from a third party library called django-secure have been integrated with django 1. 8. This implemented by a new middleware clause called SecurityMiddleware. If you started your project with django 1. 8 start project command, it will be enabled by default. The system check command also has a new flag, minus sign deploy, which will look for some possible problems when you're deploying your projects. This will give some informative errors and warnings and help you secure your projects. So don't forget to run this when you're ready to deploy. Now this is a little snippet from the new settings of by, as generated by start projects. It's a middleware clausal setting and you should take note of the lost elements. It's a new security middleware. So in case you were migrating from an earlier django version, don't forget to add that last line, django. middleware. security. securitymiddleware to your settings file.