[Answer]-Do I need to load staticfiles in included HTML in Django?

1đź‘Ť

âś…

From the Django docs:

The include tag should be considered as an implementation of “render
this subtemplate and include the HTML”, not as “parse this subtemplate
and include its contents as if it were part of the parent”. This means
that there is no shared state between included templates — each
include is a completely independent rendering process.

So, yes, your included template doesn’t know what’s happening in your main HTML, so you should include staticfiles in your included template as well.

👤Aylen

Leave a comment