Search code examples
djangodjango-rest-frameworkdjango-cron

Send request in certain date and time in django-cron


I want to send one POST request or GET request in a certain date and certain time say date is 1st feb and time is 2:00pm then request should automatically be sent at that date and time. Those date and time are stored in the database. What should be the approach for that? I tried using django-cron but it runs only when i type python3 manage.py runcrons. i want it to run when server is running i.e after every 5 mins.


Solution

  • i followed this document. I previously didn't follow

    > crontab -e
    */5 * * * * source /home/ubuntu/.bashrc && source /home/ubuntu/work/your-project/bin/activate && python /home/ubuntu/work/your-project/src/manage.py runcrons > /home/ubuntu/cronjob.log
    

    now it is working properly.