Blog available for sell
This blog is available for sale. Please 'contact us' if interested.
Advertise with us
commands pythonanywhere   1   13800
How to schedule a cron on pythonanywhere server

If you have hosted your Django app on pythonanywhere.com 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 pythonanywhere.com 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    absolute-path-to-manage.py-file  command_name e.g.

      /home/100rupeekart/VirtualEnv/bin/python3.4   /home/code108/myproject/manage.py  send_mail_command


      Add the command. To see the output of the command later on, click on the command in list of scheduled commands.

      commands pythonanywhere   1   13800
      1 comment on 'How To Schedule A Cron On Pythonanywhere Server'
      Login to comment

      Admin Oct. 16, 2018, 6:26 a.m.
      Hi Asrar, In the above line we are creating form object using the data received from html form. We can validate the post data using default or our own validation rules. I will write an article on forms soon and will share it with you. Thanks for commenting.

      Related Articles:
      Django-Admin commands cheat sheet
      A complete list of Django-Admin commands with a brief description, Django-admin commands list, Cheatsheet Django Admin commands,...
      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...
      AWS EC2 Vs PythonAnyWhere Vs DigitalOcean for hosting Django application
      This article list out the differences between three major options to deploy Django application, We are briefly comparing the digital ocean, pythonAnyWhere, and AWS EC2 to host the Django application here, AWS EC2 Vs PythonAnyWhere for hosting Django application, hosting Django application for free on AWS EC2, Hosting Django application for free on PythonAnyWhere, comparing EC2 and Pythonanywhere and DigitalOcean...
      AWS EC2 Vs PythonAnyWhere for hosting Django application
      AWS EC2 Vs PythonAnyWhere for hosting Django application, hosting Django application for free on AWS EC2, Hosting Django application for free on PythonAnyWhere, comparing ec2 and pythonanywhere...
      DigitalOcean Referral Badge

      © 2024-2025 Python Circle   Contact   Sponsor   Archive   Sitemap