Skip to main content

Reusable application for Django introducing a message delivery framework

Project description

https://github.com/idlesign/django-sitemessage

https://img.shields.io/pypi/v/django-sitemessage.svg https://img.shields.io/pypi/dm/django-sitemessage.svg https://img.shields.io/pypi/l/django-sitemessage.svg https://img.shields.io/coveralls/idlesign/django-sitemessage/master.svg https://travis-ci.org/idlesign/django-sitemessage.svg?branch=master https://landscape.io/github/idlesign/django-sitemessage/master/landscape.svg?style=flat

Description

Reusable application for Django introducing a message delivery framework.

Schedule and send messages with several easy steps, using concepts of:

  • Messengers - clients for various protocols (smtp, jabber, twitter, telegram, facebook, vkontakte, etc.);

  • Message Types - message classes exposing message composition logic (plain text, html, etc.).

  1. Configure messengers for your project (create sitemessages.py in one of your apps):

from sitemessage.toolbox import register_messenger_objects, register_builtin_message_types
from sitemessage.messengers.smtp import SMTPMessenger

register_messenger_objects(
    # Here we register only one messenger to deliver emails.
    SMTPMessenger('user1@host.com', 'user1', 'user1password', host='smtp.host.com', use_tls=True)
)

# And register built-in message types we'd use (for Django < 1.7).
register_builtin_message_types()
  1. Schedule messages for delivery when and where needed (e.g. in a view):

from sitemessage.shortcuts import schedule_email

def send_mail_view(request):
    ...

    # Suppose `user_model` is a recipient Django User model instance.
    user1_model = ...

    # We pass `request.user` into `sender` to keep track of senders.
    schedule_email('Message from sitemessage.', [user1_model, 'user2@host.com'], sender=request.user)

    ...
  1. Periodically run Django management command from wherever you like (cli, cron, Celery, etc.):

    ./manage.py sitemessage_send_scheduled

And that’s only the tip of sitemessage iceberg, read the docs %)

Documentation

http://django-sitemessage.readthedocs.org/

Project details


Download files

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

Source Distribution

django-sitemessage-0.8.2.tar.gz (54.4 kB view details)

Uploaded Source

Built Distribution

django_sitemessage-0.8.2-py2.py3-none-any.whl (59.8 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file django-sitemessage-0.8.2.tar.gz.

File metadata

File hashes

Hashes for django-sitemessage-0.8.2.tar.gz
Algorithm Hash digest
SHA256 8bd69747bbc457eaf95382b7ee3f4ac2beccc59aad9d5d48a5c7d42c3554ea59
MD5 c3536c74f72dd6e40f25c7d74d50258d
BLAKE2b-256 70a9394a9b6bc4cfe53e930406cc568cf46f715b5eec191ba63f0d56890d8a76

See more details on using hashes here.

File details

Details for the file django_sitemessage-0.8.2-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for django_sitemessage-0.8.2-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 3714827e55a95bf71da9651ca20aae8d0caa7e7ca507474914aafde598bd0556
MD5 fb1261a4e42499e00a00a3a4ae42f286
BLAKE2b-256 3d06de1866f8038d9e4a68bff732bfe14d5aa619be1baa7768ddf3d71d1608ef

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page