-
Notifications
You must be signed in to change notification settings - Fork 113
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Help Please #60
Comments
Ok and what's the problem? |
the output was this: |
vehicle_control_system.persons.contrab -> vehicle_control_system.persons.crontab? |
not, because my file called contrab and als I run python manage.py. crontab add later python manage.py runserver, but never doesn't show print, only show print when I run python manage.py crontab run b11ab998cc14f55a4642db8bfd678835, but with python manage.py runserver never run. |
Sure...as the command will be called from a system service not from within your shell. If you're interested in the stdout stream you should redirect it into a logfile. It's documeted in the README, have a look at example 1 on settting CRONJOBS. |
ty, I'm going to review |
@kraiz I'm having the same trouble. I CAN
import os
CRONJOBS = [
('* * * * *', 'crawlers.cronjobs.scheduled_crawl', '>> /tmp/crawllog.log'),
]
from .models import CronLog
def scheduled_crawl():
CronLog.objects.create()
from django.db import models
class CronLog(models.Model):
date = models.DateTimeField(auto_now_add=True, blank=True)
def __unicode__(self):
return self.date.ctime()
I'm using django within pyenv environment. Any ideas what it is not working? |
@brayan15 @kraiz After setting the following 4 environment variables in DJANGO_SETTINGS_MODULE=core.settings.development
DATABASE_URL=postgres://my_id:my_password@localhost:5432/my_db_name
DJANGO_SECRET_KEY=my_django_secret key
PATH=~/.pyenv/shims:~/.pyenv/bin:"$PATH"
*/1 * * * * /Users/mhjeon/.pyenv/versions/3.6.0/envs/djangocrawler/bin/python /Users/mhjeon/projects/djangocrawler/manage.py crontab run b9a4006b4087d6494c1b442bcadb1db0 >> /tmp/scheduled_job.log # django-cronjobs for core I guess this probably should be added to doc or REAME, for I have spent more than 5 days searching for the right answer in futile. I owe getting the hint about environment variables to this blog, which in Korean. Note: I'm yet to test this solution on live, on AWS EBS. I only tested on local development settings. But I presume if you set those environment variables correctly, I should work on remote servers also. |
Hi @mhoonjeon, that's kind of strange. It seems |
can you tell me what is the exactly that path is point to...I am getting the similiar issue |
I usually add the following variables in SHELL=/bin/bash
PATH=/bin:/sbin:/usr/bin:/usr/sbin |
I defined my task, but doesn't want show, I added a simple code:
def my_scheduled_job():
#your functionality goes right here
print('hello')
and on setting I putted this:
CRONJOBS = [
('*/2 * * * *', 'vehicle_control_system.persons.contrab.my_scheduled_job'),
]
but first I ran python manage.py contrab add and later I run django with python manage.py runserver
The text was updated successfully, but these errors were encountered: