#100DaysOfWeb in Python Transcripts
Chapter: Days 65-68: Heroku and Python Platform-as-a-Service
Lecture: Install Heroku scheduler
0:01 Now that Heroku has our credit card numbers
0:04 let's pop back into the app here
0:07 and now we can actually canfigure out add-ons.
0:10 And as we've discussed
0:11 we're going to be working with Heroku Scheduler.
0:14 So you can either click in Find More Add-ons
0:17 to get that big list
0:19 or we can simply search for it here.
0:22 And there is our Heroku Scheduler there.
0:26 And now when we click Provision
0:28 we will actually be able to do that
0:31 because we've entered the credit card.
0:33 So Provision your application now.
0:35 And there we have it. It's now installed
0:38 so the add-on Scheduler has been installed.
0:41 Check the documentation in its dev center article
0:43 to get started.
0:45 We're not going to bother doing that
0:46 because I'm going to show you
0:47 and to get started
0:49 we just have to click Heroku Scheduler.
0:53 That should open a pop-up
0:55 which will then log you into the Scheduler.
0:57 And really simply, we just have to click on
1:01 Add New Job. Now, what do we type here?
1:04 Now, for those of you familiar
1:05 with Unix or Linux or anything
1:08 you'll recognize this little dollar sign
1:10 that indicates this is a shell prompt.
1:13 What we are going to do here
1:14 is we're going to enter in any shell command
1:17 or script command that we want Heroku to run
1:21 with our dyno. We have a dyno here.
1:24 We're using our free tier.
1:26 We can choose how often we run this script.
1:29 We can do ten minutes hourly or daily.
1:31 And based on a certain time, UTC.
1:35 Now whenever this day-time hits
1:39 whenever we meet this criteria
1:41 your script is going to run.
1:43 Now if you're familiar with running your own scripts
1:46 which you should be at the command line
1:47 you simply type in Python and then your script name
1:54 without the little brackets there.
1:56 But, the point is this all we're doing.
1:59 We're telling Heroku now
2:00 you run this on our behalf.
2:02 This would save us having to log in
2:04 and run this every day at a certain time.
2:06 You could use this for emailing
2:08 you could use this for, you know, generating log files
2:11 and saving that off to some sort of persistent database.
2:15 You could do all sorts of things.
2:17 And if you are a Unix buff
2:19 you will, this will remind you a lot of Cron
2:22 because it's pretty much a Cron job that we're running here.
2:25 Now in the next video
2:26 what I'm going to do is I'm going to show you
2:28 how to automate sending an email through Heroku.
2:31 I won't walk you through too much of the email script
2:34 because that's not the topic here
2:37 but we will go through it very basically
2:39 and we will send ourselves an email
2:42 or scheduled using Heroku Scheduler.