Static Files#

Django handles static files (e.g. CSS, JavaScript, and images) already which coltrane leverages as part of the record command. The collectstatic management command is used to copy all static files to the output/static directory.

Referring to static assets#

Instead of hardcoding the URL path to static assets, the static template tag should be used in either markdown or HTML templates.


Using the static template tag might feel unnecessary for simpler sites, but it will automatically use hashed file names that whitenoise provides for efficient serving and caching of static files.


![music note]({% static 'images/music-note.svg' %})

Generated index.html

<img src="/static/images/music-note.abcd123.svg" />


<link src="{% static 'css/styles.css' %}" />

Generated HTML

<link src="/static/css/styles.wxyz789.css" />