Django Basics Course

Go to class
Write Review

Free Online Course: Django Basics Course provided by Treehouse is a comprehensive online course, which lasts for 3-4 hours worth of material. The course is taught in English and is free of charge.

Overview
  • 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
    • Django's project and app structure
    • Django's ORM and migrations

Syllabus
  •   Say Hello to Django

     

    Before we can build anything, we need to get Django installed, start our project, and learn some key concepts.

    4 steps
    • Django?

      1:02

    • Installing Django

      1:29

    • Starting the Project

      2:18

    • Introduction

      5 questions

      What a View!

     

    With Django installed and a project started, we'll dive into views, URLs, and how to start an app.

    8 steps
    • Running the Server

      4:03

    • runserver

      1 question

    • Hello Django

      3:09

    • HttpResponse

      2 objectives

    • What Are URLs?

      3:28

    • First URL

      2 objectives

    • Our First App

      4:26

    • What's an App?

      5 questions

      Model Administration

     

    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!

    9 steps
    • What are Models?

      7:14

    • First Model

      3 objectives

    • Adding Instances

      6:58

    • Models.__str__

      1 objective

    • First App View

      7:38

    • First app view

      2 objectives

    • Django's Admin

      5:39

    • Register a model with the admin

      2 objectives

    • Creating Instances, using the Shell, and the Admin

      5 questions

      Django Templates

     

    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.

    12 steps
    • Templates

      9:51

    • List template

      1 objective

    • Template Inheritance

      4:15

    • Override a block

      2 objectives

    • Static Assets

      5:26

    • Static tag

      2 objectives

    • Step by Step

      7:25

    • Add a Writer model

      3 objectives

    • Add a Detail View

      7:33

    • Writer view

      2 objectives

    • Ordering and 404s

      5:38

    • Migrations and 404s

      5 questions

      Final Details

     

    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.

    6 steps
    • Step Detail View

      5:52

    • Article detail view

      3 objectives

    • Content Field

      5:06

    • Add a field to Article to reference the Writer

      1 objective

    • url Tag

      10:35

    • URL tag In list template

      2 objectives

      Test Time

     

    Good applications work. Great applications work and have tests to prove it. Let's see about testing our models, views, urls, and templates.

    8 steps
    • Model Tests

      4:16

    • Test our Writer model

      2 objectives

    • View Tests

      6:26

    • Test our article list view

      1 objective

    • Template Tests

      4:15

    • Test our article detail template

      2 objectives

    • Congratulations!

      0:54

    • Django TDD

      1 objective