Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Where should I put base.html in django project?

Tags:

django

What is the correct way to put the base.html file in django so that other apps can modify it?

like image 400
Harshit Garg Avatar asked Oct 19 '25 09:10

Harshit Garg


1 Answers

You can place it anywhere you want in your templates directory. I suggest at the root of your templates directory.

project/
    app-1/
    ...
    app-n/
    templates/
        base.html

Your templates directory should be listed under the TEMPLATES setting in the settings.py.

TEMPLATES = [
    {
        'BACKEND': 'django.template.backends.django.DjangoTemplates',
        'DIRS': [
            '/path/to/project/templates',
        ],
        'APP_DIRS': True,
        'OPTIONS': {
            'context_processors': [
                ...
            ],
        },
    },
]
like image 126
Noah Avatar answered Oct 22 '25 02:10

Noah