#100DaysOfWeb in Python Transcripts
Chapter: Days 65-68: Heroku and Python Platform-as-a-Service
Lecture: What did we learn?
Login or
purchase this course
to watch this video and the rest of the course contents.
0:00
And that was a couple of days of Heroku deployment. Nothing too intense, I hope. This one's intentionally a bit easier just to give you a break.
0:10
Which I hope you appreciate. But moving onto what we covered This is just a simple overview list of how we deployed our first Heroku app
0:21
and we did that by first downloading and installing the Heroku CLI. So I'll breeze through these quite quickly.
0:28
We then initialized a directory of our app as a git repository so we could push that code up to Heroku. We pip installed the gunicorn web server
0:40
we created our requirements.txt file this had all of the dependencies that our app needs in order to run and we can push that up to Heroku.
0:50
We then created the actual Heroku app. This is the sort of URL that our app is going to use and it was Heroku create app name that we used
1:00
to make that. We created the proc file which told Heroku how to launch our app. We created the runtime.txt file
1:11
which specified the Python version we were running. And when we were done, we committed and pushed the code to Heroku. That was pretty much it.
1:20
Really simple process, once you've done it once or twice you should be able to get this down pretty quickly so not too complicated there.
1:30
And skipping over the actual Heroku scheduler, just because that was pretty straightforward, it was as simple as
1:37
just putting your script name into that line and running it. We'll skip straight to sendgrid
1:45
and with the sendgrid script, we just imported the modules. That's how we began. Imported email content and mail
1:53
from sendgrid. Then we defined the sendgrid API key. So that was super important. This is what links our script back to that sendgrid account.
2:04
Then, we populated all of those required fields to make the email. So we had our from email, we had our subject
2:12
to email and content that had everything we needed. We used test@example.com to send the email from
2:20
and then you can put in whatever you want for the to email. Then we packaged it all up into our little mail component there
2:29
and we used the mail object to send it off to sendgrid self, and they then forwarded it off to your recipient.
2:40
And that's it, that was Heroku. Nice and simple. Really simple way to get some apps in the cloud and a couple of simple plugins that should
2:48
make your life a lot easier. So I hope you had fun. Keep calm, and code in Python.