how to tips   0   6
How to schedule a cron on pythonanywhere server

If you have hosted your Django app on server and you want to schedule a cron job on the server to execute some task periodically ( daily or hourly) then this article is for you. cron jobs are executed after a fixed interval of time, repetitively until stopped explicitly. This may come handy if you want to send bulk mails every hour or you may want to take a backup of your database or basically anything you want to perform periodically.

Creating and hosting Django app:
In one of our previous article we discussed how to create a django application in less than 5 minute. This article contain step by step process to develop django app complemented by code on github and a video tutorial on youtube. In another related article we discussed how to host a django app on server for free. In this article we listed benefits of pythonanywhere server and steps to host the app in details.  Article consist of screenshots to help you and a video tutorial showing working of article steps.
How to schedule cron on pythonanywhere server:
  • First make sure you have created your custom management command which will perform the task. e.g. sending emails or creating backup etc.
  • First run this command from terminal and check if it is working as expected or not.
  • Go to schedule tab in your account on pythonanywhere server. how to schedule a cron on pythonanywhere server
  • As you can see that you can schedule a cron on daily basis. Hourly basis scheduling is available to paid users only.
  • Time is given in UTC format.
  • Select the hours and minutes accordingly and in command path input field enter the complete command with below format. absolute-path-to-python  command_name e.g.
    /home/100rupeekart/VirtualEnv/bin/python3.4   /home/code108/myproject/  send_mail_command
  • Add the command. To see the output of the command later on, click on the command in list of scheduled commands.
Please comment if you have any query.   Create a free account on pythonanywhere with 30 days money back guarantee on paid account. Pay monthly.
how to tips   0   6

0 thoughts on 'How To Schedule A Cron On Pythonanywhere Server'
Leave a comment:

*All Fields are mandatory. **Email Id will not be published publicly.

Please subscribe to get the latest articles in your mailbox.

Recent Posts: