1.添加‘django.template.context_processors.request‘,
2.在模板的html中输入
{{ request.path}}
{{ request.get_host}}
3.结果
django-获取当前url和ip
1.添加‘django.template.context_processors.request‘,
2.在模板的html中输入
{{ request.path}}
{{ request.get_host}}
3.结果
django-获取当前url和ip