SwampDragon: Real-Time Notifications for your Django App
Modern websites must include real-time notifications. Facebook, LinkedIn, and Gmail are classic examples. But many smaller business websites and apps use notifications to improve user interaction.
According to its developers, “SwampDragon is a pub/sub solution running on top of Tornado, and is compatible with Django models.”
They go on to state that “it allows data to be published to channels via routers and does all the heavy lifting.“
These are the main feature of SwampDragon:
• Real-time data
• Self-publishing model
• Serializers handling Django models
• Customisable field serializers
• Routers easy to understand
• Angular JS support
• Query style data subscriptions
• Easy to implement in existing Django projects
SwampDragon makes use of Django’s ORM, Tornados WebSocket support (with fallback), and Redis.
The first step is to install the SwampDragon package:
pip install swampdragon
Now you can create your own project.
To create a new project, you should run:
dragon-admin startproject notifications
django-admin.py startapp demo
The next step is to add demo to the INSTALLED_APPS. After that, you should open the notifications/settings.py file in your preferred text editor and include the lines:
STATIC_ROOT = os.path.join(BASE_DIR, 'static_root')
MEDIA_URL = '/media/'
MEDIA_ROOT = os.path.join(BASE_DIR, 'media')
# Additional locations of static files
STATICFILES_DIRS = [
TEMPLATE_DIRS = [
And that’s all! The next step will depend on what you want to do. If you’re at a lost, you should check out SwampDragon’s documentation.