change django administration title
Open the Django project in a code editor.
Navigate to the application directory where the
admin.py
file is located.Import the
AdminSite
class fromdjango.contrib.admin
.
from django.contrib.admin import AdminSite
- Create a custom admin class that inherits from
AdminSite
.
class CustomAdminSite(AdminSite):
site_header = 'Your Custom Title'
Replace 'Your Custom Title'
with the desired title for the Django administration.
- Instantiate the custom admin site.
custom_admin_site = CustomAdminSite(name='custom_admin')
Replace 'custom_admin'
with the desired name for the custom admin site.
- Update the
urls.py
file in the same application directory.
from django.contrib import admin
urlpatterns = [
# Replace the default admin.site.urls with the custom admin site
path('admin/', custom_admin_site.urls),
# Add other URL patterns as needed
]
Save the changes to the
admin.py
andurls.py
files.Run the Django development server to apply the changes.
python manage.py runserver
Visit the admin URL in your browser, and you should see the updated title in the Django administration.