没有项目描述

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

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
java使用Eclipse Helios for Web项目   java指定行。作为编译器设置的分隔符?   osm映射中带有osmdroid的java标记   java Android ClassNotFoundException在路径:DexPathList上未找到类   java从j2me调用GWT方法   更新到java 8后的aspectj问题   如何仅从根元素java,com提取文本内容。滴虫软件。是的。html   安卓公司。谷歌。火基。数据库DatabaseException:未能转换java类型的值。将字符串改为长字符串   从java中的方法返回arraylist变量   java如果将引用重新分配给同步块内的锁对象,会是什么?   java下载。使用spring mvc的资源文件中的xlsx文件   java Eclipse提供了什么工具来运行Eclipse中未包含的程序?   spring boot Java泛型如何读取传递给泛型方法的类型上的字段或调用方法   Javacard中的javaecdsa签名