def login_by_ip(view_func):

    def authorize(request, *args, **kwargs):
        user_ip = request.META['REMOTE_ADDR']
for ip in allowedIps.allowedIps:
    authenticated_by_ip = re.compile(ip).match(user_ip)
if authenticated_by_ip:
    return view_func(request, authenticated_by_ip, *args, **kwargs)
return HttpResponseRedirect('/redirect/path/')
return authorize
Аутентификация по IP-адресу в Django