开发者

Django template tag to return IP Address?

I need to write a simple Django template tag t开发者_运维问答hat will display the user's IP Address?


You need to take the information from the request (via the view function) in order to present it on a template.

You can't trivially write a custom tag since the IP address must come from the request.


you can also do this using context processors, http://docs.djangoproject.com/en/dev/ref/templates/api/#writing-your-own-context-processors


If you did it with javascript, you could just use this:

jsonip.com

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜