Change Django Admin header to nginx

I followed this question to change the title bar of the django admin panel.

I tried this:

There is an easy way to set the title of an administrative site - assign it to the current admin in urls.py like this

admin.site.site_header = 'My admin'

But it just works when I run the page through Python manage.py runserver

My question is how to change the header of the admin header when I start the site through gunicorn and nginx

+6
source share
4 answers

writing this code below urls.py somehow worked:

 admin.site.site_header = 'My admin' 
+21
source

If you already have an admin.py file in which you registered your models, you can simply configure 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' 

Here you can find all the attributes.

+4
source

follow the steps below to set up the site title and the site title text of the django admin account:

1.) First, import the admin module into the settings.py file, as shown below:

 from django.contrib import admin 

2.) At the bottom of the settings.py file, add the following lines:

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

The above method works in the latest version of django ie1.11.3 up to date.

+2
source

You can make changes to the administrator part by providing a template in the administrator subdirectory of your template directory to override what is provided by the administrator.

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

+1
source

Source: https://habr.com/ru/post/981404/


All Articles