Hi everyone! ![]()
I’m excited to announce django-smart-ratelimit v1.0.2, a modern, high-performance rate limiting library for Django with pluggable backends and async support.
What is it?
A drop-in rate limiting solution that works with Django views, DRF, and async views out of the box.
from django_smart_ratelimit import ratelimit
@ratelimit(key="ip", rate="100/h")
def my_view(request):
return JsonResponse({"status": "ok"})
Key Features
-
Pluggable Backends: Memory, Redis (sync + async), MongoDB, or Multi-backend with automatic failover
-
Async Native: Full support for async views with `@aratelimit`
-
Circuit Breaker: Built-in circuit breaker pattern for backend resilience
-
Flexible Keys: Rate limit by IP, user, custom functions, or combinations
-
Standard Headers: Automatic `X-RateLimit-*` headers on responses
-
DRF Integration: Works seamlessly with Django REST Framework
What’s New in v1.0.2
-
Comprehensive Test Suite: Multi-version testing across Python 3.9-3.13 and Django 3.2-5.1
-
Documentation: Now hosted on ReadTheDocs
-
CI Improvements: Full integration test matrix with GitHub Actions
Quick Start
pip install django-smart-ratelimit
# settings.py
INSTALLED_APPS = [
...
"django_smart_ratelimit",
]
# For Redis backend (recommended for production)
RATELIMIT_BACKEND = "redis"
RATELIMIT_REDIS_URL = "redis://localhost:6379/0"
Links
Would love to hear your feedback! Questions, issues, and PRs are welcome. ![]()