没有项目描述
mailchimpworker的Python项目详细描述
===
MailChimp_Sender_软件包
==
快速入门
--
0。安装程序包:
pip install mailchimpworker
1。将“mailchimp_sender_package”添加到已安装的应用程序设置中,如下所示:
installed_apps=[
…
'mailchimpworker',
…
]
2。进行迁移:
python manage.py make migrations mailchimpworker
python manage.py migrate
3。在“设置”中添加MailChimp API密钥。py::
MailChimp API密钥='您的API密钥'
4。使用settings.py、wsgi.py等创建文件夹。文件“celeriy.py”包含以下内容::
而不是“[proj_name]”
app=celeriy('[proj_name]');插入项目名称而不是“[proj_name]”
app.config_from_object('django.conf:settings',namespace=”芹菜“)
app.conf.broker\u url='redis://localhost:6379/0'
app.conf.beat\u schedule={
'mailchimpworker.tasks.send\u new\u email':{
'task':'mailchimpworker.tasks.send\u new\u email',
'schedule':crontab(minute=0),
'args':([你的列表ID],[你的类别ID],[你的兴趣ID])”应该是字符串,而不是列表
},
}
app.autodiscover_tasks()
>5。编写视图以创建模型订阅服务器的对象,并将其与窗体绑定。视图示例:
from django.shortcuts import render
from mailchimpworker.models import subscriber
def new_subscriber(请求):
data_email=request.post.get('email')
unique_check=subscriber.objects.filter(email=data_email)
如果不是len(唯一检查):
subscriber.objects.create(email=data_email)
返回render(request,“[path_u to_u template].html,{})
p.s.要正确运行脚本,需要运行芹菜辅助程序:
celeriy-a[proj_name]worker-l info-b
MailChimp_Sender_软件包
==
快速入门
--
0。安装程序包:
pip install mailchimpworker
1。将“mailchimp_sender_package”添加到已安装的应用程序设置中,如下所示:
installed_apps=[
…
'mailchimpworker',
…
]
2。进行迁移:
python manage.py make migrations mailchimpworker
python manage.py migrate
3。在“设置”中添加MailChimp API密钥。py::
MailChimp API密钥='您的API密钥'
4。使用settings.py、wsgi.py等创建文件夹。文件“celeriy.py”包含以下内容::
而不是“[proj_name]”
app=celeriy('[proj_name]');插入项目名称而不是“[proj_name]”
app.config_from_object('django.conf:settings',namespace=”芹菜“)
app.conf.broker\u url='redis://localhost:6379/0'
app.conf.beat\u schedule={
'mailchimpworker.tasks.send\u new\u email':{
'task':'mailchimpworker.tasks.send\u new\u email',
'schedule':crontab(minute=0),
'args':([你的列表ID],[你的类别ID],[你的兴趣ID])”应该是字符串,而不是列表
},
}
app.autodiscover_tasks()
>5。编写视图以创建模型订阅服务器的对象,并将其与窗体绑定。视图示例:
from django.shortcuts import render
from mailchimpworker.models import subscriber
def new_subscriber(请求):
data_email=request.post.get('email')
unique_check=subscriber.objects.filter(email=data_email)
如果不是len(唯一检查):
subscriber.objects.create(email=data_email)
返回render(request,“[path_u to_u template].html,{})
p.s.要正确运行脚本,需要运行芹菜辅助程序:
celeriy-a[proj_name]worker-l info-b