Django Page Checklist
If you’ve never worked with Django, it’s worth going through the Django Girls Tutorial or the one on the Django Project website. If you’re trying to add a Django page and aren’t sure you’re doing it right, make sure you have the following things:
- The page will need a view function that will generate the page’s data and render a template with that data filled in.
- The view will need a template to render.
- The template may need to inherit off any shared base template.
- If it’s inheriting, the template will need to establish blocks to fill in the base template, and fill in any inherited material in the blocks with block.super.
- The app’s urlpatterns will need to have a listing for the page’s URL.
- If the page is in a new app (which should be created with
$ manage.py startapp), the app will need to be included in settings.INSTALLED_APPS and the app’s
urls.pywill need to be included in the main project
NOTE: the steps relating to views assume function-based views. Some Django sites use class-based views instead. These are more advanced; don’t worry about using them when you’re first starting out. The other steps in this checklist will be the same regardless of what type of views you are using.
Updated 10 June 2018 to change to Django 2.