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.

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:

      Please comment if you have any query.  Create a free account on pythonanywhere with 30 days money back guarantee on paid account. Pay monthly.

      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.

      Related Articles:
      How to create management commands in Django
      creating custom management commands in Django application, Background tasks in Django App, Scheduled tasks in Django, How to schedule a task in Django application, How to create and schedule a cron in Django...
      How to upgrade to paid account on PythonAnyWhere
      Which is the best server for hosting Django Apps. Best hosting provider for Django Apps. Cheapest Django Hosting. PythonAnyWhere Reviews. Django Hosting....
      Automatically updating Django website hosted on PythonAnyWhere server with every git push
      How to automate the process of updating website hosted on python any where server everytime you commit and push code to git repository....
      How to backup database periodically on PythonAnyWhere server
      Scheduling the database backup in DJango, script to backup database periodically in Django app, Delete old backup files periodically in Django app, PythonAnyWhere server database backup in Django,...

      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:

      © 2017-2019 Python Circle   Contact Us   Advertise with Us