python - How do you extend a Django project root HTML file in project apps? -
below structure of django app:
project/ static/ app1/ app2/ app3/ ...
so have django project, , want keep html/css styling uniform across apps in project.
how 1 go extending html template residing in project folder each of these apps?
i have been successful extending html templates within app folders each respective app.
my project settings has static files set located in "/static/"
you can put project-common templates in project/templates
, add /path/to/project/templates
template_dirs
setting in settings.py
file. prepend root else, gets searched first:
template_dirs = ( # don't forget use absolute paths, not relative paths. "/path/to/projects/templates", #other dirs ... )
then go extend application templates usual:
{# app1/templates/app1/template1.html #} {% extends "template_in_project_root.html" %} ...
Comments
Post a Comment