artem
artem

Reputation: 16808

Django - extend template from parent directory

I have this templates structure:

dir1: base.html dir2: template.html

template.html must extend base.html:

{% extends '../dir1/base.html' %}

But it raises error:

Caught TemplateDoesNotExist while rendering: ../dir1/base.html

Upvotes: 3

Views: 5248

Answers (1)

gruszczy
gruszczy

Reputation: 42228

You should set template dir (https://docs.djangoproject.com/en/dev/ref/settings/#template-dirs) in settings.py and then use {% extends 'dir/base.html' %}.

Upvotes: 7

Related Questions