--- id: django-ratelimit version: "4.1.0" license: Copyright (c) 2022, James Socol Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License… (full text in the JSON record) license_treatment: permissive maintenance: dormant --- # django-ratelimit — Cache-based rate-limiting for Django. License: permissive · Maintenance: dormant · Downloads: 2.7M/mo ## What it is and what it does Django Ratelimit is a lightweight decorator-based rate-limiting library for Django views. It enforces request limits by tracking access patterns in Django's cache backend, allowing you to throttle views based on IP address or custom request fields. The library is designed to protect views from abuse by rejecting requests that exceed a specified rate. The package has been stable since its initial release and supports Python 3.7, 3.8, 3.9, 3.10, and 3.11. It carries no external runtime dependencies beyond Django itself, making it straightforward to integrate into existing projects. Maintenance is dormant but the codebase is marked Production/Stable and sees substantial real-world use. Use it for: - Protect API endpoints from brute-force attacks by limiting requests per IP address - Throttle user-submitted form submissions to prevent spam or resource exhaustion - Enforce fair-use policies on public endpoints by rate-limiting per authenticated user or session - Prevent scraping or automated access to sensitive views by capping request frequency - Implement tiered access control where different endpoints have different rate limits ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. Provides a Django decorator to rate-limit views based on IP address or request fields (GET/POST variables). Yes. The package is production-stable, dependency-free, and widely used. Dormant maintenance is not a blocker for a mature, single-purpose tool with no known vulnerabilities. Install if you need straightforward IP- or field-based rate-limiting in Django; consider alternatives only if you need advanced features like distributed rate-limiting across multiple servers or async view support. ## Install pip install django-ratelimit uv add django-ratelimit poetry add django-ratelimit ## Installing django-ratelimit Before you install: Low friction install with no runtime dependencies. Dormant maintenance status (last commit 2024-07-11, no releases in over 1 year), but marked Production/Stable and actively used across millions of monthly downloads. License in practice: Apache Software License 2.0 (permissive). You may use, modify, and distribute this package freely in commercial and private projects, provided you include the license notice. Quickstart: pip install django-ratelimit from django_ratelimit.decorators import ratelimit @ratelimit(key='ip', rate='10/h') def my_view(request): return HttpResponse('OK') Requires Django and Python 3.7 or later; rate-limiting depends on Django's cache framework being configured. Verify before relying: - Whether rate-limit state persists across Django cache backends or is limited to specific cache types - Whether the decorator supports async Django views or only synchronous views - Specific rate-limit format syntax and supported time windows beyond the examples in documentation ## Package facts - License: Copyright (c) 2022, James Socol Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License… (full text in the JSON record) (permissive) - Python support: supports_current - Install friction: low - Maintenance: dormant - Downloads: 2.7M/month (top 5,000 on PyPI) - Known vulnerabilities: none known ## Tags django rate limiting decorator, limit requests per ip, django view throttling, cache-based rate limiting, django request throttle, prevent api abuse, django rate limit views, rate-limiting, django-middleware, api-protection [View on SkillFed](https://skillfed.io/packages/django-ratelimit) · [View on PyPI](https://pypi.org/project/django-ratelimit/)