UpenderSingh / django-cron

Automatically exported from code.google.com/p/django-cron
MIT License
0 stars 0 forks source link

django cron not working #22

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Hi Jim,

Sorry to disturb you. I set up my cron by following the instruction exactly
but the it still does not work. What do you think could be the reason?

from app.cron import cronScheduler
from app.cron import Job

# This is a function I wrote to check a feedback email address and add it
to our database. Replace with your own imports

class Cron_task(Job):
        """
                Cron Job that checks the lgr users mailbox and adds any
approved senders' attachments to the db
        """

        # run every 300 seconds (5 minutes)
        run_every = 5

        def job(self):
                # This will be executed every 5 minutes
                #print_something()
                f = open('/tmp/sample.txt', 'a')
                f.write("Hi Paul\n")
                f.close()

cronScheduler.register(Cron_task)

I used "tail -f /tmp/sample.txt" to check the update but nothing happened.
Many thanks!

BTW, when I tried "python manage.py syncdb"

The following error came out: "Error: No module named cronapp.errors"

What is "cronapp.errors"?!

Kind regards,

Joe

Original issue reported on code.google.com by zhuxiyu...@googlemail.com on 19 Oct 2009 at 10:53

GoogleCodeExporter commented 9 years ago
I think that I should summarise my problem again:
1. Create a new project and add django_cron.autodiscover() to your urls.py
2. Run manage syncdb
3. I've got an error:

/var/lib/python-support/python2.6/MySQLdb/__init__.py:34: DeprecationWarning: 
the
sets module is deprecated
  from sets import ImmutableSet
Error: No module named cronapp.errors

Original comment by zhuxiyu...@googlemail.com on 19 Oct 2009 at 11:56

GoogleCodeExporter commented 9 years ago
BTW, the apache error log:

[Wed Oct 21 09:22:08 2009] [error] [client 127.0.0.1] mod_mime_magic: invalid 
type 0
in mconvert().
[Wed Oct 21 09:22:08 2009] [error] [client 127.0.0.1] mod_mime_magic: invalid 
type 0
in mconvert().
[Wed Oct 21 09:22:14 2009] [error]
/var/lib/python-support/python2.6/MySQLdb/__init__.py:34: DeprecationWarning: 
the
sets module is deprecated
[Wed Oct 21 09:22:14 2009] [error]   from sets import ImmutableSet
[Wed Oct 21 09:22:16 2009] [error] [client 127.0.0.1] mod_mime_magic: invalid 
type 0
in mconvert().
[Wed Oct 21 09:22:16 2009] [error] [client 127.0.0.1] mod_mime_magic: invalid 
type 0
in mconvert().

Original comment by zhuxiyu...@googlemail.com on 21 Oct 2009 at 8:36

GoogleCodeExporter commented 9 years ago
It looks like you may have renamed the app from django_cron to cronapp. I'm not 
sure
if you can do that

Original comment by Jim.mixt...@gmail.com on 27 Oct 2009 at 4:40

GoogleCodeExporter commented 9 years ago
It seems like that refactoring is not the issue. The cron worked once or twice
previously but not any more. Now I've no longer have any errors but the cron 
just
doesn't work.

BTW I have a technical question here: Why the cron has to be so sophisticated? 
I have
written a very simple one. Could you please have a quick look and tell me why 
it is a
bad idea? many thanks!

from threading import Timer
import time

t = 10

def cronjob():
    def job():        

        # do something

    job()
    Timer(t, cronjob).start()

cronjob()

Original comment by zhuxiyu...@googlemail.com on 28 Oct 2009 at 12:18

GoogleCodeExporter commented 9 years ago
addressed via email and in the wiki

Original comment by Jim.mixt...@gmail.com on 26 Feb 2010 at 1:03