Harshit Garg
Harshit Garg

Reputation: 2259

Where should I put base.html in django project?

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

Upvotes: 4

Views: 1023

Answers (1)

Noah
Noah

Reputation: 1731

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': [
                ...
            ],
        },
    },
]

Upvotes: 4

Related Questions