Create cronjob for django management command async process
Recently i have facing some problem with cronjob set with django project
In my case i need to pull the data from external api and save the data in every minute then i write this code
Please do following steps.
1. Create management folder in your app folder and in management folder add commands folder.
add file e.g import_jobs.py
from __future__ import unicode_literals, absolute_import, division
from django.core.management.base import BaseCommand
import logging
logger = logging.getLogger(__name__)
#-------------------------------------------------------------------------------
# Command
#-------------------------------------------------------------------------------
class Command(BaseCommand):
help = "Add Jobs from BH Portal"
#---------------------------------------------------------------------------
# handle
#---------------------------------------------------------------------------
def handle(self, *args, **options):
# add your logic here
pass
Comments
Post a Comment