Learning Django

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 https://github.com/django/django.git



Starting with Django-CRM

Installation with Homebrew (Mac OS)

Installation from Source

pip install django
pip install django-crm
git clone https://github.com/MicroPyramid/Django-CRM
pip install -r requirements.txt
python manage.py makemigrations
python manage.py createsuperuser
python manage.py runserver

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 pat.name %}[name='{{ pat.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 pat.name %}[name='{{ pat.name }}']{% endif %}        
{% endfor %}