Skip to content

Customising appearance

Dave Lawrence edited this page Oct 14, 2020 · 1 revision

Templates / Static files

Django looks for templates and static files in locations specified in settings and retrieves the first one it finds. Thus to overwrite defaults with custom files, put them at the start of the settings.

# Need to use absolute (not relative) paths
MY_STATIC_FILES_DIR = os.path.join(VARIANTGRID_APP_DIR, "static_files", "my_static_files")
STATICFILES_DIRS = (MY_STATIC_FILES_DIR, ) + STATICFILES_DIRS

MY_TEMPLATES_DIR = os.path.join(VARIANTGRID_APP_DIR, "templates/my_templates")
TEMPLATES[0]["DIRS"].insert(0, MY_TEMPLATES_DIR)

Minimise custom-code

It is strongly advised you try and minimise the amount of duplication used to style sites as it adds to maintenance work. If only a small part of a page needs styling, please extract out the parts that change into separate files (then include them or use a template tag)

Clone this wiki locally