Change header 'Django administration' text on nginx

自闭症网瘾萝莉.ら 提交于 2019-12-05 07:02:16

writing this code at the bottom of urls.py somehow worked:

admin.site.site_header = 'My admin'

If you already have an admin.py file started wherein you have registered your particular models, you can simply adjust these values there.

your_app/admin.py

# Simple admin setup
from django.contrib import admin
from .models import MyModel
# Register model
admin.site.register(MyModel)
# Tweak admin site settings like title, header, 'View Site' URL, etc
admin.site.site_title = 'My App Admin'
admin.site.site_header = 'My App Admin'

You can find all the attributes here.

follow the below steps to customize the site header and site title text of django admin login page :

1.)First import admin module in settings.py file like as below :

from django.contrib import admin

2.)In bottom of settings.py file add these lines:

admin.site.site_header = 'MY_SITE_HEADER'
admin.site.site_title = 'MY_SITE_TITLE'

The above method works in latest version of django i.e.1.11.3 till date.

You can make changes to parts of the admin by providing a template in an admin subdir of your templates directory to override what is provided by admin.

In this case, you'd want to provide a base_site.html template. You can see what the default one looks like here: https://github.com/django/django/blob/master/django/contrib/admin/templates/admin/base_site.html

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!