I have a hosted web app made with django and react. now i want to implement a system like- one user request for posting a blog at a specific time specific date. and on that day the post is posted even if the user is not logedin or open the app. how to automate this type of task. for database i am using sqlite3.
Now How can i implement this type of task schedulling system using Django and React
3
Answers
First you need to package the logic you want to do into a script. I want to recommend to turn it into a django management command (here).
Test that the command does the correct logic when you type:
python manage.py <your-command-name>
. After running this successfully the user should have a new post.Now you want to schedule that command. This can be done by a crontab on your host device. You could also use django-crontab. This will then periodically run that command.
You can use library django-apscheduler.
Create schedule CRON for check each post with status not published, and timepost < timenow. You can schedule for every second. But i prefer to set shcedule for every 5 / 15 minutes. Prevent your server overload.
Or U can use apscheduler.triggers.date. To set schedule run on certain date
You don’t need a scheduling system for this, if I understand your intent correctly.
Simply only show posts whose publication date is in the past: