Skip to main content
Join the official 2020 Python Developers SurveyStart the survey!

A Django app for sending SMS with interchangable backends.

Project description

A Django app for sending SMS with interchangable backends.



  • Python 2.5+
  • Django 1.2+


  • ‘sms.backends.dummy.SMSBackend’
  • ‘sms.backends.locmem.SMSBackend’
  • ‘sms.backends.console.SMSBackend’

Writing a custom backend

You can write your own SMS backend by subclassing BaseSMSBackend and overriding the send_sms method. On any error, your backend should raise SMSError

class SMSBackend(BaseSMSBackend):
    My custom sms backend

    def __init__(self):
        self.client = MyClient(settings.KEY, settings.SECRET)

    def send_sms(self, message, from_, to):
        if not self.client.send_message(message, from_, to):
            raise SMSError


  1. Add an SMS backend to SMS_BACKEND in
SMS_BACKEND = 'sms.backends.console.SMSBackend'
  1. call send_sms
from sms import send_sms

send_sms(text, from_, to)


sms.original_sms_backend = settings.SMS_BACKEND
settings.SMS_BACKEND = 'sms.backends.locmem.SMSBackend'
sms.outbox = []

sms.send_sms('my message', 'me', 'you')
self.assertIn('message', sms.outbox[0]['text'])

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for django-sms, version 0.0.4
Filename, size File type Python version Upload date Hashes
Filename, size django-sms-0.0.4.tar.gz (2.6 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page