django-redis-aiogram
Run aiogram next to Django: write handlers as ordinary Django app code, and send Telegram messages from anywhere in the project.
One container runs the bot. Every other process — web, Celery, a management command — pushes the call onto a Redis list and returns, so a request never waits on Telegram.
web, celery ──bot.send()──▶ Redis list ──▶ start_tgbot ──▶ Telegram
Install
pip install django-redis-aiogram
# settings.py
import os
INSTALLED_APPS = [..., 'django_redis_aiogram']
TELEGRAM_BOT = {
'TOKEN': os.environ.get('TELEGRAM_BOT_TOKEN', ''),
'REDIS_URL': os.environ.get('REDIS_URL', ''),
}
Both may be empty. Nothing connects or validates credentials at import time, so tests and migrations run without them. Requires Python 3.10–3.14, Django 5.2+, aiogram 3.30+, redis 6.2+.
Use it
# myapp/tg_router.py — imported automatically from every installed app
from aiogram import F, types
from django_redis_aiogram import bot
@bot.message(F.text == '/start')
async def start(message: types.Message) -> None:
await message.answer('hi')
# anywhere else in the project
from django_redis_aiogram import bot
bot.send(chat_id=CHAT_ID, text='Order approved')
python manage.py start_tgbot
A router module, a call, and one process running the bot. Everything else — rate limits, per-process opt-out, healthchecks — is configuration, and it is documented rather than required. Webhook mode is the one alternative that also asks for a URL route; Webhook has the four steps.
Documentation
The wiki is the
documentation. Pages live in docs/wiki/, so they are reviewed in
the same pull request as the code they describe and published from master.
| Installation | install, configure, run |
| Settings | every setting, with defaults and check ids |
| Handlers | routers, filters, FSM, the async ORM |
| Sending messages | routes, keyboards, files, errors |
| Testing | your suite without Redis, asserting what was queued |
| API | the instance, its internals, and what stays public |
| Delivery | how queued messages reach Telegram |
| Webhook | receiving updates over HTTP instead of polling |
| Rate limits | staying inside Telegram's published limits |
| Deployment | compose recipes, healthchecks, per-process opt-out |
| Logging | the logger and its structured fields |
| Serialization | what can be queued |
| Troubleshooting | symptoms and their usual causes |
| Migrating from 1.x | what changed, and what you must do |
| AI assistants | the brief to hand a coding agent |
Upgrading from 1.x: telegram_bot still imports and still works in
INSTALLED_APPS until 3.0, so nothing breaks on the version bump alone. The
migration page lists the settings that do need attention.
Contributing
CONTRIBUTING.md for the workflow, AGENTS.md for the same ground in the form coding agents read. Changes are in CHANGELOG.md; security reports go through SECURITY.md.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file django_redis_aiogram-2.2.0.tar.gz.
File metadata
- Download URL: django_redis_aiogram-2.2.0.tar.gz
- Upload date:
- Size: 99.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ea954e3875c027c5874aaa4f4055c951e0b02b29e6011b867d67565236f2aaa0
|
|
| MD5 |
ec8a9d6af1637db0c270120f130f6b8c
|
|
| BLAKE2b-256 |
328234702af00f1ac652833bd13d34d2d65946979630a8ad199e8e0728a618a6
|
Provenance
The following attestation bundles were made for django_redis_aiogram-2.2.0.tar.gz:
Publisher:
publish.yml on CorneiZeR/django-redis-aiogram
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
django_redis_aiogram-2.2.0.tar.gz -
Subject digest:
ea954e3875c027c5874aaa4f4055c951e0b02b29e6011b867d67565236f2aaa0 - Sigstore transparency entry: 2340911346
- Sigstore integration time:
-
Permalink:
CorneiZeR/django-redis-aiogram@43fa44b419c4db8c286956ffdb951bfb2111cc28 -
Branch / Tag:
refs/tags/v2.2.0 - Owner: https://github.com/CorneiZeR
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@43fa44b419c4db8c286956ffdb951bfb2111cc28 -
Trigger Event:
release
-
Statement type:
File details
Details for the file django_redis_aiogram-2.2.0-py3-none-any.whl.
File metadata
- Download URL: django_redis_aiogram-2.2.0-py3-none-any.whl
- Upload date:
- Size: 54.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1d4aad9edb851e22cb031af94d4bfc8d55ca992fcdf2c38a2acc7bab4b099080
|
|
| MD5 |
f6c8128ca26b835b75418b415d5c1fd9
|
|
| BLAKE2b-256 |
9291e7ad054f4917d451a3ef2d44cc1a3102ca24f1c756d8f8d26d0b4ea17b60
|
Provenance
The following attestation bundles were made for django_redis_aiogram-2.2.0-py3-none-any.whl:
Publisher:
publish.yml on CorneiZeR/django-redis-aiogram
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
django_redis_aiogram-2.2.0-py3-none-any.whl -
Subject digest:
1d4aad9edb851e22cb031af94d4bfc8d55ca992fcdf2c38a2acc7bab4b099080 - Sigstore transparency entry: 2340911356
- Sigstore integration time:
-
Permalink:
CorneiZeR/django-redis-aiogram@43fa44b419c4db8c286956ffdb951bfb2111cc28 -
Branch / Tag:
refs/tags/v2.2.0 - Owner: https://github.com/CorneiZeR
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@43fa44b419c4db8c286956ffdb951bfb2111cc28 -
Trigger Event:
release
-
Statement type: