获取访问者ip

http://120.25.146.222:8002/:

  1. if request.META.has_key('HTTP_X_FORWARDED_FOR'):  

  2.     ip =  request.META['HTTP_X_FORWARDED_FOR']  

  3. else:  

  4.     ip = request.META['REMOTE_ADDR']  


你可能感兴趣的:(获取访问者ip)