un33k/django-ipware

Add middleware for easy usage

wolph opened this issue ยท 3 comments

wolph commented

I'm aware that writing the middleware manually is just a few lines of code but it would be very useful to have a simple middleware available

Within views it's easy enough to simply import the methods but Django still needs patching to have INTERNAL_IPS work correctly

un33k commented

@wolph ipware is to return the IP address. Each project knows what needs to be done with the IP. Best practice is to call ipware on the first request and cache it for subsequent use. Then use the IP as it fits the project requirements.

wolph commented

I don't get what you're trying to say...

I'm saying it would be useful to have a middleware integrated into the project. Something similar to this one: https://github.com/allo-/django-xforwardedfor-middleware/blob/master/x_forwarded_for/middleware.py

As for caching, that would be a useful thing to integrate into that middleware :)

un33k commented

@wolph I see ... just a simple thing to make IP available downstream ... cool.