fold in some changes from iar-backend
Created by: rjw57
Using the boilerplate in anger resulted in a few fixes we want to back port from the iar-backend repo. Most importantly, once Django models were added, building the documentation failed as autodoc cannot import models from applications unless Django has been set up via django.setup(). Take the opportunity while there to fix an indent issue in rst_prolog.
The original flake8 config was fine for single-project django repos but it ignored any additional applications. Change the invocation to scan the entire repository. Files/directories can be omitted explicitly by modifying the .flake8 file.