django: how do I actually override admin site template


I know this is asked and answered several times but I basically went over all the post on stack overflow and still couldn’t get this to work. Right now I am just trying simply change the admin site title. I have the following:

{% extends "admin/base_site.html" %}

{% block title %}{{ title }} | {{ site_title|default:_('NEW TITLE') }}{% endblock %}

{% block branding %}
<h1 id="site-name"><a href="{% url 'admin:index' %}">{{ site_header|default:_('NEW TITLE') }}</a></h1>
{% endblock %}

{% block nav-global %}{% endblock %}

And I tried to put this in


my_site/templates/admin/my_app/base_site.html, and


but none of these work.
        'BACKEND': 'django.template.backends.django.DjangoTemplates',
        'DIRS': [os.path.join(BASE_DIR, 'templates')],
        'OPTIONS': {
            'context_processors': [
            'loaders': [

I also tried just directly changing djangocontribadmintemplatesadminbase_site.html but still nothing happens.

I am really frustrated now and definitely could use some help, thanks

Actually I found out that the local template does have effect.
enter image description here

Like here, the topmost white bar displays "#base_site.html!!@#" which is what I put in my_site/templates/admin/base_site.html as a comment by chance. So it kinda working, but I still don’t understand why I can’t change the site title.

Asked By: Hansong Li



Add your Django app above 'django.contrib.admin' in settings -> INSTALLED_APPS. The order of apps in INSTALLED_APPS matters.


    "your_app.yourAppConfig", # add your app here

use my_site/my_app/templates/admin/base_site.html

put your app where you define this template before
'django.contrib.admin', in INSTALLED_APPS

source link

Answered By: Mohit Rustagi

First open your and add a template folder:

    'DIRS': [
        '/path/to/your/django-project/templates', # Absolute Path
        # os.path.join(BASE_DIR, 'templates') # Relative Path

Then move the file base_site.html to the following directory.
It’s important to keep the structure on the file system.


Content of base_site.html:

{% extends "admin/base_site.html" %}

{% block title %}{{ title }} | {{ site_title|default:_('NEW TITLE') }}{% endblock %}

{% block branding %}
<h1 id="site-name"><a href="{% url 'admin:index' %}">Your new Title</a></h1>
{% endblock %}

{% block nav-global %}{% endblock %}

Django Documentation – Overriding Admin Site

Hope that helps.

Answered By: Tobias Ernst

So you should delete including the curly braces, and just write the text you want.

Remove: `{{ site_title|default:_('NEW TITLE') }}`  Write: NEW TITLE
Remove: `{{ site_header|default:_('NEW TITLE' }}`  Write: NEW TITLE

Also be sure that you placed the folders (templates/admin) in the root directory of your project. root directory is the container for all your app folders and also the file.

In other words, “templates” folder you want to create should be at the same level with file.

Your folder structure should look like this:

Answered By: Murat Simav

I am not sure if I understand right. but you can easy to change the title by doing this:

in the “” file

from django.contrib import admin

urlpatterns = [
] = 'My New Title' = 'My New Title'

Then it should get the job done for you.

Answered By: Ken

To change Django Admin site title, you can add these two lines in the of your Django app:

from django.contrib import admin

# change Django admin title = 'My Blog Admin'

# change Django admin site header = 'My Blog Admin'
Answered By: azmirfakkri
Categories: questions Tags: , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.