python - Filepath for Django Extending Template -
here template path
webapp/ |__templates/ |__frontpage/ | |__home.html |__home_base.html
in home.html, has:
{% extends "home_base.html" %}
this file structure work. however, want put home_base.html inside frontpage/, makes more sense. however, django report home_base.html template not exist, if home_base.html moved frontpage/.
the error says cannot find home_base.html file under templates/ folder. since home_base.html moved frontpage/, why doesn't search home_base.html inside frontpage/ first? configurations missing?
you need following template extended.
{% extends "frontpage/home_base.html" %}
django not have idea have have moved template. template according templates path have defined in settings.
the template loader template in directories defined in dirs
setting in templates
settings.
from dirs
setting documentation:
directories engine should template source files, in search order.
also, if frontpage
app , had placed template in frontpage
app instead of templates
folder, can set app_dirs
settings true
. tell django find templates in individual apps also.
from app_dirs
setting documentation:
whether engine should template source files inside installed applications.
Comments
Post a Comment