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
精彩评论