AWS + Django cronjob

I used Elastic Beanstalk to run the Django app on AWS. I want to run cronjob to update some of my models. I made a special management command ( https://docs.djangoproject.com/en/1.6/howto/custom-management-commands/ ) and can run it locally, but if I ssh into my instance and run crontab, I get the error:

There is no module named django.core.management

What is the best way to run cronjobs for a Django project on AWS?

+4
source share
2 answers

For this to work (this is undocumented, so it can be changed at any time)

*/10 * * * * source /opt/python/current/env && django-admin.py do_your_thang

/opt/python/current/env , " ", , ..

EB + cron + django EB.

0

Django 1.10.6 + AWS ElasticBeanstalk + Cronjob

* * * * * source /opt/python/run/venv/bin/activate && cd /opt/python/current/app/ && python manage.py do_your_thing > $HOME/cron-sqs.log 2>&1

do_your_thing

0

Source: https://habr.com/ru/post/1528005/


All Articles