Softpedia
 


LINUX CATEGORIES:



GLOBAL PAGES >>
NEWS ARCHIVE >>
SOFTPEDIA REVIEWS >>
MEET THE EDITORS >>
WEEK'S BEST
  • Linux Kernel 3.9.2 / 3....
  • LibreOffice 3.6.6 / 4.0.3
  • MPlayer 1.1.1
  • systemd 204
  • Arch Linux 2013.05.01
  • Blender 2.67
  • KDE Software Compilatio...
  • CrunchBang Linux Stable...
  • Elementary OS 0.1 / 0.2...
  • SystemRescueCd 3.6.0
  • Home > Linux > Internet > Django Plugins

    django-cron 0.2.7

    Download button

    No screenshots available
    Downloads: 188  Tell us about an update
    User Rating:
    Rated by:
    NOT RATED
    0 user(s)
    Developer:

    License / Price:

    Last Updated:

    Category:
    Sumit Chachra | More programs
    MIT/X Consortium Lic... / FREE
    September 19th, 2012, 16:38 GMT [view history]
    ROOT / Internet / Django Plugins

     Read user reviews (0)  Refer to a friend  Subscribe

    django-cron description

    Running Python crons in a Django project

    django-cron is a Django app that lets you run Django/Python code on a recurring basis proving basic plumbing to track and execute tasks. The 2 most common ways in which most people go about this is either writing custom python scripts or a management command per cron (leads to too many management commands!). Along with that some mechanism to track success, failure etc. is also usually necesary.

    This app solves both issues to a reasonable extent. This is by no means a replacement for queues like Celery ( http://celeryproject.org/ ) etc.

    Installation

    - Install django_cron (ideally in your virtualenv!) using pip or simply getting a copy of the code and putting it in a

    directory in your codebase.

    - Add django_cron to your Django settings INSTALLED_APPS:

     INSTALLED_APPS = [
     # ...
     "django_cron",
     ]


    - If you're using South for schema migrations run python manage.py migrate django_cron or simply do a syncdb.

    - Write a cron class somewhere in your code, that extends the CronJobBase class. This class will look something like this:

     from django_cron import CronJobBase, Schedule
     class MyCronJob(CronJobBase):
     RUN_EVERY_MINS = 120 # every 2 hours

     schedule = Schedule(run_every_mins=RUN_EVERY_MINS)
     code = 'my_app.my_cron_job' # a unique code


     def do(self):
     pass # do your thing here


    - Add a variable called CRON_CLASSES (similar to MIDDLEWARE_CLASSES etc.) thats a list of strings, each being a cron class. Eg.:

     CRON_CLASSES = [
     "my_app.cron.MyCronJob",
     # ...
     ]

    - Now everytime you run the management command python manage.py runcrons all the crons will run if required. Depending on the application the management command can be called from the Unix crontab as often as required. Every 5 minutes usually works for most of my applications.

    This opensource app is brought to you by Tivix, Inc. (http://tivix.com/).


    Product's homepage

    Requirements:

    · Python
    · Django

    What's New in This Release: [ read full changelog ]

    · Bug fix.

      


    TAGS:

    Python cron | Django project | Django cron | Django | Python | cron

    Go to top

    WindowsGamesDriversMacLinuxScriptsMobileHandheldNews

    SUBMIT PROGRAM   |   ADVERTISE   |   GET HELP   |   SEND US FEEDBACK   |   RSS FEEDS   |   UPDATE YOUR SOFTWARE   |   ROMANIAN FORUM