django-cron

Unable to make a function call using Django-cron

﹥>﹥吖頭↗ 提交于 2020-08-09 18:28:27
问题 I want to call a method once in a week for which I made an implementation as mentioned here https://gutsytechster.wordpress.com/2019/06/24/how-to-setup-a-cron-job-in-django/ I am not sure how it works, but let me explain what I did. I need to call a method as mentioned in folder structure below. proj_application | |- myapp | |-views.py (Method call Inside) |- poll_tracked() In views.py, def poll_tracked(): print('called') In settings.py, I have mentioned INSTALLED_APPS = [ 'django_crontab', ]

Unable to make a function call using Django-cron

柔情痞子 提交于 2020-08-09 18:26:11
问题 I want to call a method once in a week for which I made an implementation as mentioned here https://gutsytechster.wordpress.com/2019/06/24/how-to-setup-a-cron-job-in-django/ I am not sure how it works, but let me explain what I did. I need to call a method as mentioned in folder structure below. proj_application | |- myapp | |-views.py (Method call Inside) |- poll_tracked() In views.py, def poll_tracked(): print('called') In settings.py, I have mentioned INSTALLED_APPS = [ 'django_crontab', ]

Setting up crontab for my Django Application

狂风中的少年 提交于 2020-08-09 08:11:09
问题 I had an issue with setting up crontab for my Django application for a week and I have almost figured out the same. (Issue linked with Unable to make a function call using Django-cron) My crontab -e syntax is * * * * * /Users/ashwin/dashboard/proj_application/exec.sh >> /Users/ashwin/dashboard/proj_application/data.log 2>&1 And in my exec.sh, I have #!/bin/bash cd "$(dirname "$0")"; CWD="$(pwd)" echo $CWD python -c 'import proj_application.cron as cron; cron.test()' And in cron.py , from

Django: Getting Django-cron Running

那年仲夏 提交于 2019-11-30 09:49:03
问题 I am trying to get Django-cron running, but it seems to only run after hitting the site once. I am using Virtualenv. Any ideas why it only runs once? On my PATH, I added the location of django_cron: '/Users/emilepetrone/Workspace/zapgeo/zapgeo/django_cron' My cron.py file within my Django app: from django_cron import cronScheduler, Job from products.views import index class GetProducts(Job): run_every = 60 def job(self): index() cronScheduler.register(GetProducts) class GetLocation(Job): run