--- id: django-ipware version: "7.0.1" license: MIT license_treatment: permissive maintenance: dormant --- # django-ipware — A Django application to retrieve user's IP address License: permissive · Maintenance: dormant · Downloads: 5.9M/mo ## What it is and what it does django-ipware is a Django wrapper around the python-ipware library that extracts a client's originating IP address from a request object. It handles the complexity of proxy headers—such as X-Forwarded-For, X-Real-IP, and CloudFlare headers—by checking them in a configurable precedence order. The package returns both the IP address and a boolean indicating whether it is publicly routable. The main use case is in Django views or middleware where you need to log, authenticate, or make decisions based on the client's real IP rather than the immediate request source (which may be a load balancer or reverse proxy). It supports advanced scenarios like trusted proxy lists, proxy count filtering, and custom header precedence orders via Django settings or function parameters. The package explicitly warns that it is not a complete defense against IP spoofing and should be layered with firewall rules and authentication measures. Use it for: - Log the real client IP in Django middleware or views when behind a load balancer or CDN. - Validate client IP against a trusted proxy list to filter spoofed requests in security-sensitive operations. - Extract originating client IP for rate limiting, geolocation, or fraud detection workflows. - Configure custom header precedence for non-standard proxy setups (e.g., internal corporate proxies). - Determine whether a client IP is private or publicly routable for conditional business logic. ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. Retrieves the client's IP address from a Django request object, handling proxies and multiple header precedence orders to extract the originating client IP. Yes, if you are running Django behind one or more proxies and need reliable client IP extraction. The package is stable (Production/Stable classifier), supports modern Python versions (3.8–3.12), has no known vulnerabilities, and low install friction. Dormant maintenance is acceptable for a focused, mature utility. Not necessary if your Django app runs without proxies or if you handle IP extraction via your proxy/load balancer configuration. ## Install pip install django-ipware uv add django-ipware poetry add django-ipware ## Installing django-ipware Before you install: Low friction: pure Python wheel with a single runtime dependency (python-ipware). Maintenance is dormant—last release was 847 days ago, though the repository remains active with 1066 stars and no archived status. Suitable for stable, non-evolving use cases. License in practice: MIT license is permissive and poses no restrictions on commercial or proprietary use. You may use, modify, and distribute this package freely provided you retain the license notice. Quickstart: pip install django-ipware from ipware import get_client_ip client_ip, is_routable = get_client_ip(request) if client_ip: print(f"Client IP: {client_ip}, Routable: {is_routable}") Requires Django request object; IP spoofing is not prevented—use trusted_proxies_ips or proxy_count parameters to validate against known proxy infrastructure. Verify before relying: - Exact behavior differences between django-ipware and its underlying dependency python-ipware beyond the wrapper layer. - Performance characteristics when handling requests with many proxy headers or large header lists. - Whether dormant maintenance status indicates sufficient stability for new projects or signals deprecation risk. ## Package facts - License: MIT (permissive) - Python support: supports_current - Install friction: low - Maintenance: dormant - Downloads: 5.9M/month (top 5,000 on PyPI) - Known vulnerabilities: none known ## Tags django get client ip address, django request ip extraction, django proxy ip detection, django x-forwarded-for handling, django client ip middleware, django ip address retrieval, django load balancer ip, django-integration, request-metadata, proxy-handling [View on SkillFed](https://skillfed.io/packages/django-ipware) · [View on PyPI](https://pypi.org/project/django-ipware/)