Skip to main content
=====
mailchimp_sender_package
=====


Quick start
-----------
0. Install package::
pip install mailchimpworker

1. Add "mailchimp_sender_package" to your INSTALLED_APPS setting like this::

INSTALLED_APPS = [
...
'mailchimpworker',
...
]

2. Make migrations::
python manage.py makemigrations mailchimpworker
python manage.py migrate

3. Add the MAILCHIMP_API_KEY in settings.py::
MAILCHIMP_API_KEY = 'YOUR API KEY'

4. Create into folder with settings.py, wsgi.py and etc. file 'celery.py' with this content::

from __future__ import absolute_import, unicode_literals
import os
from celery import Celery
from celery.schedules import crontab

os.environ.setdefault("DJANGO_SETTINGS_MODULE", "[proj_name].settings") # insert project name instead of "[proj_name]"

app = Celery('[proj_name]') # insert project name instead of "[proj_name]"
app.config_from_object('django.conf:settings', namespace='CELERY')
app.conf.broker_url = 'redis://localhost:6379/0'
app.conf.beat_schedule = {
'mailchimpworker.tasks.send_new_emails': {
'task': 'mailchimpworker.tasks.send_new_emails',
'schedule': crontab(minute=0),
'args': ([YOUR_LIST_ID], [YOUR_CATEGORY_ID], [YOUR_INTEREST_ID]) # that should be strings, not lists
},
}
app.autodiscover_tasks()

5. Write view for creating objects of model Subscriber and bind him with forms. Example of view::

from django.shortcuts import render
from mailchimpworker.models import Subscriber

def new_subscriber(request):
data_email = request.POST.get('EMAIL')
unique_check = Subscriber.objects.filter(email=data_email)
if not len(unique_check):
Subscriber.objects.create(email=data_email)
return render(request, '[path_to_"thanks"_template].html', {})

P.S. To run scripts correctly, you need to run Celery-worker:
celery -A [proj_name] worker -l info -B

Release files for mailchimpworker 0.17

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for mailchimpworker 0.17
File Size Uploaded
mailchimpworker-0.17.tar.gz 3.8 kB Details

Release files / mailchimpworker-0.17.tar.gz

Download URL mailchimpworker-0.17.tar.gz
Size 3.8 kB
Tags Source
SHA-256 checksum
How to use checksums
96287862aa15b6a8ce9a051b6a95678275795d1628112af4c10c76db0af39044
BLAKE2b-256 checksum
How to use checksums
af7c020b37e4e5fbdb7b55333f83c0ee0bcac7e074a024adb75782fc9128630d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

0.17 This release

1 release file

0.16

1 release file

0.15

1 release file

0.14

1 release file

0.13

1 release file

0.12

1 release file

0.11

1 release file

0.1

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page