1π
The easy way to solve this problem is to namespace your templates. Create an application and inside the application directory (where you have the default views.py
) create a templates directory, and inside that directory create a subdirectory which is the name of the application.
Imagine you have a project myproj
and an app called registration, then you would have:
.
βββ manage.py
βββ myproj
βΒ Β βββ __init__.py
βΒ Β βββ settings.py
βΒ Β βββ urls.py
βΒ Β βββ wsgi.py
βββ registration
βββ admin.py
βββ __init__.py
βββ migrations
βΒ Β βββ __init__.py
βββ models.py
βββ templates
βΒ Β βββ registration
βΒ Β βββ base.html
βββ tests.py
βββ views.py
Now even if you have another application with a template called base.html
, you can always load the specific template you need with {% extends 'registration/base.html' %}
π€Burhan Khalid
Source:stackexchange.com