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