16.1 Introduction

Websites are usually a combination of HTML, CSS, JavaScript, and media. At the moment, our website is HTML only, which means it’s rather uninspiring. The goal of this chapter is to add CSS and an image (a site logo) to our website. Django refers to this content as static content because Django is not generating the content, unlike HTML (or any other markup).

Adding an image or a CSS file is quite simple: we could simply edit any of our templates to add an HTML tag (img, link, etc.) to connect to our files. The trick, once again, is maintaining DRY. Django provides the staticfiles contributed app as a means to organize nongenerated files. Specifically, the app allows us to move these files to different directories: Django will ...

Get Django Unleashed now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.