16.2 Adding Static Content for Apps

The staticfiles contributed app is enabled by default in the INSTALLED_APPS list in suorganizer/settings.py, which means we can jump straight into it.

Much like templates, static files are app-centric by default. In Example 16.1, we create a static/ directory in each of our apps, and then namespace these directories again, just as we did our templates.

Example 16.1: Shell Code

$ mkdir -p organizer/static/organizer $ mkdir -p blog/static/blog

With the directories in place, we can now create CSS files in each of these directories, as shown in Example 16.2.

Example 16.2: Shell Code

$ touch organizer/static/organizer/style.css $ touch blog/static/blog/style.css ...

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.