Use request.remote_ip instead of request.ip