Locked lesson.
About this lesson
In this lesson, we'll connect our project to Heroku and add our SSH Key to ensure security.
Exercise files
Download this lesson’s related exercise files.
Add SSH Keys and Create Heroku App.docx60.4 KB 35 - Add SSH Keys and Create Heroku App SOLUTION.docx
58.1 KB
Quick reference
Add SSH Keys and Create Heroku App
In this video we'll add our SSH keys to Heroku and create an app.
When to use
Do this once per project.
Instructions
Head over to heroku.com and sign up for a free account.
From the terminal:
heroku login
Add your SSH keys:
heroku keys:add
Create an app on heroku:
heroku create
To rename your app:
heroku rename NEWNAME
Hints & tips
- heroku login
- heroku keys:add
- heroku create
- heroku rename NEWNAME
- 00:04 Okay, so we've got the Heroku Toolbelt installed.
- 00:06 Now we need to connect to Heroku from our terminal and create an app.
- 00:11 So I'm going to assume that you signed up for Heroku, you have an account.
- 00:14 So the first thing we need to do is login to Heroku from our terminal.
- 00:19 Again, make sure you're in c/mywebsite/djangowebsite.
- 00:24 Make sure you can see the master here and
- 00:27 make sure your virtual environment is turned on.
- 00:31 So, to log into Heroku, we just type in heroku login.
- 00:35 And it's saying press any key to open the web browser to login,
- 00:40 we're just going to hit enter.
- 00:42 When I do, a web browser opens, we can click here to login and
- 00:47 it's going to ask you for your credentials and it says, hey, you're logged in.
- 00:52 Head back over to our terminal and you can see it notices that we're logged in and
- 00:58 has our email for our Heroku account.
- 01:01 Now hit Ctrl+C to break out of this.
- 01:05 Okay, so let's go ahead and clear the screen.
- 01:08 Now, we have logged into our Heroku account.
- 01:11 Now we need to add our SSH keys that we created a few videos ago.
- 01:15 So with GitHub, we had to actually copy and paste them.
- 01:19 We don't have to do that with Heroku, we can just type in heroku keys:add.
- 01:26 And again it's telling me there's an update available, I can ignore that.
- 01:31 It says we found your SSH keys at .ssh\id_rsa.pub
- 01:36 which is where we save them.
- 01:38 Would we like to upload them?
- 01:40 Yes. So it's uploading them and it's done.
- 01:44 So now we can hit Ctrl+C again to break out of there.
- 01:47 And let's clear the screen.
- 01:49 So we've added our SSH keys, we've logged in, now let's create an app on Heroku.
- 01:55 So let's go heroku and if you haven't noticed yet, most of the commands
- 02:00 we're going to type start with Heroku when we're dealing with Heroku.
- 02:06 So, heroku create.
- 02:08 It's creating an app.
- 02:10 And here, it's been created.
- 02:12 Here is the URL for our app.
- 02:14 So, we can copy this and head back over to our web browser, open another tab,
- 02:19 and paste this in, and here's our app.
- 02:21 Now, this is just the default screen obviously.
- 02:25 And this URL is really kind of weird, right?
- 02:28 So we can rename that if we want.
- 02:30 Now later on, I'm going to show you how to use your own domain name like,
- 02:35 johnelder.com or something.
- 02:37 But for now, we're just going to rename this to a Heroku URL.
- 02:41 So to do that, we just head back over here and
- 02:45 type in heroku rename and then just name it.
- 02:49 So I'm going to say, I don't know,
- 02:52 my resume it's probably already taken.
- 02:57 Yeah, see my resume is already taken.
- 02:59 So let's try,
- 03:04 Let's write djangoresume.
- 03:07 Your resume is already taken.
- 03:09 Okay, let's try djangoresume2.
- 03:13 All right, looks like that is available.
- 03:16 So, obviously that's kind of a bad name, but
- 03:21 you get the idea that's how you actually change it.
- 03:26 So we come back here and paste that in.
- 03:29 And again, we just see the default app.
- 03:32 But that's djangoresume2.herokuapp.com.
- 03:35 It's at least a little bit better than that whispering
- 03:40 whatever it was in the beginning when we first created this.
- 03:45 So that's really all there is to it to connecting to Heroku logging in and
- 03:50 creating an app.
- 03:51 Now we just need to push our current code up to Heroku.
- 03:54 And we actually have to make a couple of slight modifications to our code before we
- 03:59 can do that in order for it to work on Heroku.
- 04:02 Heroku has some settings and
- 04:05 things like that that they want to see, so
- 04:10 we'll set that up in the next video.
Lesson notes are only available for subscribers.