[Answer]-How do you extend a Django project root HTML file in project apps?

1👍

You can put your project-common templates in Project/templates and add the /path/to/Project/templates to your TEMPLATE_DIRS setting in your settings.py file. prepend the root to everything else, so it gets searched first:

TEMPLATE_DIRS = (
    # Don't forget to use absolute paths, not relative paths.
    "/path/to/Projects/templates",
    #other dirs ...
)

Then you go extend it from your application templates as usual:

{# App1/templates/App1/template1.html #}
{% extends "template_in_project_root.html" %}
...

the TEMPLATE_DIRS setting

Leave a comment