我不可能在 heroku 中使用 django-crontab 运行 cron 作业。Cron 作业似乎在我本地运行良好,但在 heroku 服务器中失败。按照本教程,没有heroku它可以正常工作(https://hprog99.wordpress.com/2014/08/14/how-to-setup-django-cron-jobs/)
跟大家分享一下我的代码:
设置.py
INSTALLED_APPS = [
'django_crontab',
# more codes
]
CRONJOBS = [
('0 0 * * *', 'cinemas.cron.hello')
]
电影院/cron.py
def hello():
print('This job is run every day at 12am.')
最后我跑了这个:
python manage.py crontab add
但是,heroku 会产生此错误消息:
/var/spool/cron: No such file or directory
似乎heroku中没有cron目录?无论如何,如果我要在heroku中使用django-crontab?
谢谢