Skip to main content

Email async notifications with celery.

Project description

Async notifications

Email notification with celery and administrative view for send email with delay e.g daily

Features

  • Celery integration

  • Administrative view

  • Enqueued mail system and instantly send

  • Problems notification

  • User filter email

  • Template system with template context

Installation

  1. Install from pip

    $ pip install async_notifications
  2. Insert async_notifications in your settings INSTALLED_APPS

  3. It’s really important set CELERY_MODULE pointing to your project celery file, because it’s needed for assing task to the current project, and configure some default celery options

            from __future__ import absolute_import
    
    CELERY_MODULE = "demo.celery"
    CELERY_TIMEZONE = TIME_ZONE
    CELERY_ACCEPT_CONTENT = ['pickle', 'json']
    
    from celery.schedules import crontab
    
    CELERYBEAT_SCHEDULE = {
        # execute 12:30 pm
        'send_daily_emails': {
            'task': 'async_notifications.tasks.send_daily',
            'schedule': crontab(minute=30, hour=0),
        },
    }
  4. Configure your email settings, e.g for development

    DEFAULT_FROM_EMAIL="mail@example.com"
    EMAIL_HOST="localhost"
    EMAIL_PORT="1025"
  5. Run migrations

    $ python manage.py migrate

Runing the project

You need to fun 3 subsystems for run this app so you need 3 xterm, for this explanation I will use the demo project

  1. Run smtp debug client

    $ python -m smtpd -n -c DebuggingServer localhost:1025
  2. Run celery, if you aren’t setup celery yet see celery documentation.

    $ celery -A demo worker -l info -B
  3. Run django

    $ python manage.py runserver

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

async_notifications-0.0.3.tar.gz (14.3 kB view details)

Uploaded Source

File details

Details for the file async_notifications-0.0.3.tar.gz.

File metadata

File hashes

Hashes for async_notifications-0.0.3.tar.gz
Algorithm Hash digest
SHA256 bce02b033f6309d2286a8883978a2cc2f989d92da555936eb93ef3bae8729d60
MD5 10be6eaf483ebcc2310741dbd2e70be2
BLAKE2b-256 2b3805c8643072f90a29973e1a427b37c3ad1896cc6d9f4998ac9619a69ca37e

See more details on using hashes here.

Provenance

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