in settings.py file ..
BLOCKED_IPS = ('127.0.0.1',) --- > touple of ip addressed
and in our view just simple ---- >
from django.conf import settings
from django import http
if request.META['REMOTE_ADDR'] in settings.BLOCKED_IPS:
return http.HttpResponseForbidden('<h1>Forbidden</h1>')
return render_to_response("home-page.html")