For example, change it to 'www.baidu.com'
高洛峰2017-06-22 11:53:22
I took a look at the django (1.9.8) source code, and this link is indeed the hard-coded site_url = '/' in the source code (/path/to/python/site-packages/django/contrib/admin/sites.py). Then reference href="{{ site_url }}" in html (/path/to/python/site-packages/django/contrib/admin/templates/admin/base.html) without setting a constant in settings.py What.
If you really don’t want to modify the source code, try adding a custom context_processors at the end of ./settings.py TEMPLATES, and also define a site_url = '/xxx/' in it to see if it can be achieved (I haven’t tested it yet) Pass).
Process:
1. Create a new self_context_processors.py, content:
def set_url(request):
return {'site_url': '/xxx/'}
2. Add at the bottom of settings TEMPLATE context_processor:
'self_context_processors.set_url',
天蓬老师2017-06-22 11:53:22
The crudest way is to copy site-packages/django/contrib/admin/templates/admin/base.html to your project directory/templates/admin/base.html, and then modify href="the url you want"