Django Cookbook

Django Tutorial: Polls App

Tutorial: Django-Polls App

We start with this amazing tutorial in building a Django polls app. The final code of the tutorial is here.

After this, we will extend the App with additional feature like Bootstrap and Angular 8.

Starting with Django

Installation with Pip

$ pip install Django
$ python -m django --version
$ python -c "import django; print(django.__file__)"

Install from Source

$ git clone


Configure development environment

Visual Studio Code

pip install pylint-django

Helpfull links and documentation


Tipps and Tricks

Customize 404 Page

If Django could not find a page for a given url, the following page ist used as error page:


Find the line with

{% for pat in pattern %}
{{ pat.pattern }}
{% if forloop.last and %}[name='{{ }}']{% endif %}
{% endfor %}

Replace the content with

{% for pat in pattern %}
<a href="{{ request.build_absolute_uri }}/{{ pat.pattern }}">{{ pat.pattern }}</a>
{% if forloop.last and %}[name='{{ }}']{% endif %}        
{% endfor %}