Foreword
django's admin home page displayed by default "Django administration", title shows "Django site administrator", copy the content here may modify the content of the page into the background of their own projects
Home and title
Background django opening the home page, the corresponding program is modified to copy, modify two places below
Modify admin.py
sites.py source inside AdminSite class below site_title, site_header, index_title three values
class AdminSite:
"""
An AdminSite object encapsulates an instance of the Django admin application, ready
to be hooked in to your URLconf. Models are registered with the AdminSite using the
register() method, and the get_urls() method can then be used to access Django view
functions that present a full admin interface for the collection of registered
models.
"""
# Text to put at the end of each page's <title>. site_title = gettext_lazy('Django site admin') # Text to put in each page's <h1>. site_header = gettext_lazy('Django administration') # Text to put at the top of the admin index page. index_title = gettext_lazy('Site administration') # URL for the "View site" link at the top of each admin page. site_url = '/'
Admin.site override attribute values inside at admin.py
- site_header set content on the page
- title content site_title the upper left corner of the page
- index_title Admin
# admin.py
admin.site.site_header = 'xx 项目管理系统'
admin.site.site_title = '登录系统后台'
admin.site.index_title = '后台管理'
Refresh the page, you can see the modified content
index_title you can see the contents have been modified after successful login