When it comes to Python web frameworks, the elephant (pony?) in the room is Django. Let's explore this framework and build the prototype of an e-learning site. We'll look into Django's admin, ORM, migrations, and template system. In the end, you'll have a project you can use to explore even more of the Django world.
What you'll learn
Django's project and app structure
Django's ORM and migrations
Say Hello to Django
Before we can build anything, we need to get Django installed, start our project, and learn some key concepts.
Starting the Project
What a View!
With Django installed and a project started, we'll dive into views, URLs, and how to start an app.
Running the Server
What Are URLs?
Our First App
What's an App?
We want to be able to hold data in our application so we need to create at least one model. And once we have a model, we're going to want to be able to create instances of it. Django's ORM and Admin to the rescue!
What are Models?
First App View
First app view
Register a model with the admin
Creating Instances, using the Shell, and the Admin
No application is complete without some sort of user-facing interface. Let's see how to add and use HTML templates in our Django projects. We'll also explore using CSS assets in our project.
Override a block
Step by Step
Add a Writer model
Add a Detail View
Ordering and 404s
Migrations and 404s
Our app could use another view and a bit more information for each step. We can add those and finally get some things linked up with a handy new tag.
Step Detail View
Article detail view
Add a field to Article to reference the Writer
URL tag In list template
Good applications work. Great applications work and have tests to prove it. Let's see about testing our models, views, urls, and templates.