首页 > 其他 > 详细

celery笔记

时间:2020-01-21 09:50:52      阅读:80      评论:0      收藏:0      [点我收藏+]

安装:pip install celery==4.1.0(django==1.11, redis==2.10.6, django-redis==4.4.0, kombu==4.1.0)
执行异步任务命令(二选一):
celery -A celery_task.task worker --pool=solo -l info
celery -A celery_task.task worker -l info

执行定时任务命令(需要登录后台管理页面添加任务):
celery -A celery_task.task worker -l info

保存结果需安装:django-celery-results==1.0.4

Issues with mysql
If you want to run django-celery-results with MySQL, you might run into some issues.

One such issue is when you try to run python manage.py migrate django_celery_results, you might get the following error:

django.db.utils.OperationalError: (1071, ‘Specified key was too long; max key length is 767 bytes‘)
To get around this issue, you can set:

DJANGO_CELERY_RESULTS_TASK_ID_MAX_LENGTH=191
(or any other value if any other db other than MySQL is causing similar issues.)

max_length of 191 seems to work for MySQL.

window开启mysql远程访问方法:
1、放通3306端口,防火墙添加入站规则
2、user表127.0.0.1改为%
3、flush privileges;

mysql设置时区:set global time_zone = ‘+8:00‘;

celery笔记

原文:https://www.cnblogs.com/Fmaj7/p/12220689.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!