Posts

Showing posts with the label cronjob

Setting up or scheduling a task or cron job in Django

Image
  Hey folks! I’ve got something interested to share which I recently learned. You already know it, don’t you? Yes, from the title. Well then, let’s get start with it. When working on a project, you might require to setup a cron job. Those who don’t know what a cron job is, “cron” is a utility that schedule scripts or commands to be run automatically at specified time and date or intervals and these tasks or jobs are what we call as “cron job”. Every *nix system has a default cron utility. Crons are identified by  crontab (cron-tab file), a configuration file that specifies the commands to be run periodically. However, to set up a cron job in Django, we can make use of a third party module which I found really useful,  django-crontab How to write a cron job? Before we go any further, we must understand the syntax in which a cron job is defined. Yes, a cron job has a specified format which can be understand by the cron utility. The main part of a cron is its timing syntax which defines t

Django Background Tasks

Image
  I started working in   django   a while ago and I am in love with it. Everything is just too simple unlike   Nodejs   where the callbacks suck the life out of you. You can find countless tutorials online to get started with this excellent framework . I would highly recommend  codingforentrepreneurs  . Do watch their  tryDjango  series . Here is a  link  to their YouTube channel. Now lets come back to the point. A few days back I wanted to run some background tasks in Django . I had no idea where to get started . Google came to my rescue . The answers I found were : Celery Threading Redis Queue Django-Channels Twisted And many more… But all I wanted to do was some background work. No! I am not afraid to learn something new , but to install a whole new bulky framework for such a small task seemed like an overhead to me .Secondly I am a Windows user . And most of these frameworks were deigned for Linux based systems. Don’t believe me ??? See it for yourself . Celery 4.1 documentation So