I have REST API built on Django and JS application. Both are on different domains. How to change django admin "view site" link in such way so it will open JS application? I've tried to pass absolute link (https://docs.djangoproject.com/es/1.10/ref/contrib/admin/#django.contrib.admin.AdminSite.site_url), but looks like it does not work - only relative paths allowed
The Django admin is a powerful built-in tool giving you the ability to create, update, and delete objects in your database using a web interface. You can customize the Django admin to do almost anything you want.
To change the admin site header text, login page, and the HTML title tag of our bookstore's instead, add the following code in urls.py . The site_header changes the Django administration text which appears on the login page and the admin site. The site_title changes the text added to the <title> of every admin page.
To do so, you will have to change the project's settings.py . Find the TEMPLATES section and modify accordingly. To override the default template you first need to access the template you want to modify from the django/contrib/admin/templates/admin directory.
In Django 1.11.5, it seems that :
from django.contrib import admin
and
admin.site.site_url = 'https:....'
in the admin.py file is enough
I prefer resetting admin.site.site_url
in urls.py
, along with other site changes (instead of doing this in an admin.py
file, cause a project can have serveral admin.py)
# urls.py
admin.site.site_url = '' # Removes the 'View Site' link
admin.site.site_header = 'My Site'
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With