由于想看下android虚拟机中的IP
http://blog.sina.com.cn/s/blog_8a94d82b0101bdvd.html
但是在adb shell下面用getprop得到的是10开头的ip 觉得不靠谱
手机中查看IP
http://www.geekfan.net/1386/
于是向django后台接受android虚拟机的请求获取请求的远程IP
http://www.baozi.in/2010/08/django-form-deal/
request.get_host不是一种好方法
http://blog.csdn.net/bravezhe/article/details/7374934
用meta信息才靠谱
- if request.META.has_key('HTTP_X_FORWARDED_FOR'):
- ip = request.META['HTTP_X_FORWARDED_FOR']
- else:
- ip = request.META['REMOTE_ADDR']