[Answered ]-Importing app templates and static files to other templates Django

1👍

With the line {% static 'css/gallery.css' %} you are trying to get the static file gallery.css located in the directory ‘css’ but this directory doesn’t exist as gallery is put in just the directory ‘static’ and not ‘static/css’. Try doing it by {% static 'gallery.css' %} or creating a directory ‘css’ in static and putting gallery.css in it.

1👍

Old question and I’m sure you’ve either figured out a solution or moved on, but you need to add:

{% load static %}

in your gallery.html beneath the {% extends 'base.html' %}. Django templates require you to load static files on any template that you are using them in regardless if they are included in a template that you are extending from. See here for a better reference.

👤alacy

Leave a comment