亚洲国产日韩欧美一区二区三区,精品亚洲国产成人av在线,国产99视频精品免视看7,99国产精品久久久久久久成人热,欧美日韩亚洲国产综合乱

python - How to change the view_site on the Django admin homepage to the URL you want? (Try not to modify the django source code)
我想大聲告訴你
我想大聲告訴你 2017-06-22 11:51:22
0
2
774


For example, change it to 'www.baidu.com'

我想大聲告訴你
我想大聲告訴你

reply all(2)
小葫蘆

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',

Peter_Zhu

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"

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template