Django

Django Tutorial

Rate limiting middleware for Django projects.

1. Installation

pip install halt[django]

2. Middleware Configuration

Add HaltMiddleware to your MIDDLEWARE setting in settings.py.

MIDDLEWARE = [
    # ... other middleware
    'halt.adapters.django.HaltMiddleware',
]

HALT = {
    'store': 'memory',  # or 'redis', 'postgres'
    'policy': 'public_api' # defined in code or presets
}

3. Defining Policies

You can define the policy in your settings.

from halt import presets
            
# In settings.py
HALT_POLICY = presets.PUBLIC_API