Package: django-gearman-proxy
django-gearman-proxy is django app containing backends/workers for asynchronous email and sms sending
using gearman as message queue.How it worksEmailsThis app enables you to send email asynchronously without blocking current threads, while
sending email messages via various backends.This setting in your project settings file does the following:# E-mails are sent to proxy backend.
EMAIL_BACKEND = 'django_gearman_proxy.backends.mail.EmailBackend'

# Email backend to be used inside of mail sender worker.
GEARMAN_EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'All email messages are sent to proxy email backend defined in settingsEMAIL_BACKEND, in this example‘django_gearman_proxy.backends.mail.EmailBackend’. This backend serializes email message to json format and
submit it as background job to gearman message queue. django-gearman-proxy contains asynchronous email worker
implemented as django command. You have to start this command to make the magic work.$ python manage.py send_emailRight aftersend_emailcommand is up and running, it pulls email message job from gearman message queue,
unserialize it from json and send it via backend defined inGEARMAN_EMAIL_BACKEND, in this example‘django.core.mail.backends.smtp.EmailBackend’. This architecture allows to send email messages directly from
your django application, without blocking request/response cycles because email messages are sent in background.Sms messagesThis app enables you to send sms messages asynchronously without blocking current threads, while
sending sms messages via various backends.This setting in your project settings file does the following:# Sms messages are sent to proxy backend.
SMS_BACKEND = 'sendsms.backends.smssluzbacz.SmsBackend' = 'django_gearman_proxy.backends.sms.SmsBackend'

# Sms backend to be used inside of sms sender worker.
GEARMAN_SMSL_BACKEND = 'sendsms.backends.smssluzbacz.SmsBackend'All sms messages are sent to proxy sms backend defined in settingsSMS_BACKEND, in this example‘django_gearman_proxy.backends.sms.SmsBackend’. This backend serializes sms message to json format and
submit it as background job to gearman message queue. django-gearman-proxy contains asynchronous sms worker
implemented as django command. You have to start this command to make the magic work.$ python manage.py send_smsRight aftersend_smscommand is up and running, it pulls sms message job from gearman message queue,
unserialize it from json and send it via backend defined inGEARMAN_SMS_BACKEND, in this example‘sendsms.backends.smssluzbacz.SmsBackend’. This architecture allows to send sms messages directly from
your django application, without blocking request/response cycles because sms messages are sent in background.For more information how to run command as asynchronous workers, please
refer todjango-gearman-commands.Requirementspython 2.7+djangodjango_gearman_commandssmssluzbacz-apidjango-sendsmspython-gearmanrunning gearman daemonInstallationInstall via pypi or copy this module into your project or into your PYTHONPATH.Put django_gearman_proxy into INSTALLED_APPS in your projects settings.py fileINSTALLED_APPS = (
    'localeurl',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.sites',
    'django.contrib.admin',
    'django.contrib.sitemaps',
    'web',
    'debug_toolbar',
    'rosetta',
    'south',
    'django_gearman_proxy'
)Configurationdjango settings.py constants# E-mails are sent to proxy backend.
EMAIL_BACKEND = 'django_gearman_proxy.backends.mail.EmailBackend'

# Email backend to be used inside of mail sender worker.
GEARMAN_EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'

# Serializers for transporting EmailMessage object via gearman protocol.
GEARMAN_EMAIL_SERIALIZER = 'django_gearman_proxy.serializers.mail.json.serialize'
GEARMAN_EMAIL_UNSERIALIZER = 'django_gearman_proxy.serializers.mail.json.unserialize'


# Sms messages are sent to proxy backend.
SMS_BACKEND = 'django_gearman_proxy.backends.sms.SmsBackend'

# SMS backend to be used inside of sms sender worker.
GEARMAN_SMS_BACKEND = 'sendsms.backends.smssluzbacz.SmsBackend'

# Serializers for transporting SmsMessage object via gearman protocol.
GEARMAN_SMS_SERIALIZER = 'django_gearman_proxy.serializers.sms.json.serialize'
GEARMAN_SMS_UNSERIALIZER = 'django_gearman_proxy.serializers.sms.json.unserialize'TestsTested on evnironmentXubuntu Linux 12.04.1 LTS precise 64-bitpython 2.7.3+python unittestdjango 1.4.5gearmand 1.1.1Running testsTo run the tests from your django project, run command:$ python manage.py test django_gearman_proxyAuthorchar0n (Vladimír Gorej, CodeScale s.r.o.)email:gorej@codescale.netweb:http://www.codescale.net/Referenceshttp://github.com/CodeScaleInc/django-gearman-proxyhttp://pypi.python.org/pypi/django-gearman-proxy/http://www.codescale.net/en/community#django-gearman-proxy