Loading…

Complete Code for the Django Tutorial, Step by Step

Are you stuck in the Django tutorial? Compare your code to this complete and tested solution of the Django tutorial on GitHub. I have worked through the tutorial and made a commit after each change, so you can not only look at the final outcome but also at each individual step along the way!

The official Django tutorial, where you build a simple poll application, is a great starting point for learning Django. The tutorial is well written and explains each step of building the polls app in detail.
A screenshot of the Polls app you build in the official Django 2.0 tutorial

But if you misunderstand an instruction or make a typo, you can end up with an error that might be incomprehensible to you. As each step in the tutorial builds on the previous step, it might be hard to tell where you made a mistake and what your code should actually look like.

For example, if you are stuck in the section of Part 3 where you remove the hardcoded URLs in templates, you can jump to the corresponding tag and see what the template should like.

Step-by-step

Here is the complete list of all steps in the tutorial. Follow the link to explore the code directly on GitHub. Alternatively, you can download each step as a Zip archive.

Part 1:

Part 2:

Part 3:

Part 4:

Part 5:

Part 6:

Part 7:

I hope this will save some people some head scratching while completing the Django Tutorial. Let me know if you find this useful!

What’s next?

Once you have completed the Django tutorial, you might wonder how to move on. Here is an article outlining possible next steps after the Django tutorial.

[subscribe_form_django]

One thought on “Complete Code for the Django Tutorial, Step by Step

  1. Near the end of Part 5, they suggest writing more tests, like for the ResultsView, but I can’t figure out what the get_queryset() should look like for that (since it is a Question plus the Choice(s) that belong to that question.

Leave a Reply