Bummer! This is just a preview. You need to be signed in with a Basic account to view the entire video.
Start a free Basic trial
to watch this video
In this video, we’ll set up our Heroku application on the Heroku dashboard, explore what the Heroku dashboard offers us as developers, and learn some Heroku-specific terminology that will help us understand how to deploy our apps.
-
0:04
Hi I'm Ken and I'm a Django teacher for treehouse.
-
0:07
Building applications in Django isn't the most difficult thing in the world, and
-
0:11
you probably built a couple by now, either with treehouse or on your own.
-
0:15
Once you build your project though you'll want the world to see it.
-
0:18
Years ago deploying python and Django sites, well it wasn't fun.
-
0:22
I remember keeping a very long text file of all of the steps I needed to do
-
0:26
to get updates deployed on a site I built with a very early version of Django.
-
0:30
Those days are far behind us now though with platforms like Heroku.
-
0:34
Heroku provides all of the supporting tools your Django site needs,
-
0:37
like a database and web server, and
-
0:39
makes deploying updates a simple as pushing changes to a git repository.
-
0:43
Stick around and I'll show you how to get your Django site live on Heroku.
-
0:47
So I'm gonna start by creating a Heroku app.
-
0:50
So, you should go to Heroku.com and sign up or log in if you haven't already.
-
0:55
And what you're currently seeing is the Heroku Dashboard.
-
0:58
Now, this may look different when you get there.
-
1:01
I have sadly no control over what Heroku does,
-
1:04
but this is how Heroku looks right now.
-
1:07
So this dashboard is an overview of all the apps you have on Heroku,
-
1:11
as well as ways of adjusting settings for those apps.
-
1:15
Ar Heroku app is kind of like a container for your Django project code.
-
1:18
It's where you put the code that you want to Heroku to run, by creating an app
-
1:23
on the Heroku dashboard you're effectively reserving space in Heroku for your app.
-
1:28
So I'm going to click the new button up here in the top right corner, and
-
1:33
I'm going to choose new app from the drop down,
-
1:35
I could also click create a new app right there.
-
1:38
Now in the app name field I'm going to put in a name for
-
1:43
my Heroku app, so I'll call it djanoal.
-
1:47
In the run time selection here
-
1:51
I'm just going to leave this as United States because where I'm based.
-
1:53
If you are based in Europe or Asia, you might want to choose Europe.
-
1:57
So, I'm going to hit create app.
-
2:00
And now I'm looking at the dashboard with a Heroku app selected.
-
2:06
So you'll probably be taken directly to this Deploy tab, but
-
2:10
let's take a minute to talk about what each of these tabs on the dashboard does.
-
2:14
If we click Overview, then we get this Overview screen for our Heroku app.
-
2:18
We can see all of our configured add-ons we can see all of our dynos, and
-
2:23
see the activity, what we've done,
-
2:26
what our collaborators have done, all that kind of stuff.
-
2:30
This becomes more and more useful as you do more and more stuff.
-
2:36
If I click on resources, then I see two sections, I see Dynos, and I see Add-ons.
-
2:42
Now Dynos are a central concept to deploying with Heroku,
-
2:45
you're going to see this word a lot.
-
2:47
The number of Dynos that you have roughly correlates to how much computing power and
-
2:52
memory your app has.
-
2:54
With the Heroku free tier, which is what I'm gonna be using for
-
2:57
all of this workshop.
-
2:58
I'm limited to Heroku's smallest dyno sizes, and
-
3:02
I'm limited in the number of hours the dynos can be active.
-
3:05
Roughly though it equates to being able to run the app, run the project on a single
-
3:10
machine with about 512 megs of RAM, and I can run it for about 500 hours per month.
-
3:18
Exact details are in the teacher's notes, but
-
3:20
this free tier is more than enough to get things started and just play around.
-
3:25
You'll notice that there is no diners right now though because
-
3:28
I haven't deployed anything to the Heroku app.
-
3:31
Once I deploy an app with a proc file which will get to in a bit,
-
3:35
this section will have a lot more information.
-
3:37
So I'll talk more about proc files and
-
3:39
this section in a future video, the add-ons section right down here,
-
3:45
is where we can add external sources and services to the Heroku app.
-
3:49
Part of the benefit of deploying with Heroku is a huge range of third party
-
3:52
services like logging tools and data stores and all sorts of stuff.
-
3:57
These add-ons are specially configured to work well with Heroku app
-
4:00
with a very little configuration for you.
-
4:03
A lot of them have free tiers,
-
4:04
some of them do cost money, you'll investigate them each as you need them.
-
4:08
We're gonna add an add-on right now though, and what I wanna do is here in
-
4:13
this add-ons bar I'm gonna search for Heroku Postgres, and look there it is.
-
4:19
I'm gonna select that and
-
4:21
then notice these are the different price tiers, right?
-
4:24
So if I want just the hobby one which is what I want, that's free But
-
4:28
it goes all the way up to $7,000 per month for
-
4:32
this Private 7 database, that's just amazing.
-
4:36
So I'm gonna choose the Hobby Dev-Free and I'm gonna hit Provision, and
-
4:41
that's going to provision this database for me.
-
4:45
And now you can see it's down here, all right, there's that.
-
4:49
In creating and
-
4:50
developing this django project I've been using SQL lite as a data store.
-
4:55
SQL lite is great for local development, but it doesn't work on a Heroku.
-
4:59
Heroku dynos provide computing power and memory, but they have no disk space.
-
5:04
Only the things that are bundled into your project are available to tje Heroku app,
-
5:08
and you can't expect changes to files to stick,
-
5:11
only if they change in your GitHub repo and
-
5:13
your Git repo they'll stick, if they change anywhere else they will not stick.
-
5:18
Since we don't have a permanent file system SQLite out of the question.
-
5:22
And so because of that I'll be connecting the Django project
-
5:25
to this Postgres database, and I'll do that in the future video.
-
5:29
So let's move on to the tabs, let's go back to the deploy tab and here we see
-
5:34
the methods that Heroku offers for getting your project deployed to Heroku app.
-
5:37
We'll focus on this a bit more in a future video, but
-
5:41
if you want to scroll through here and read stuff over go for it.
-
5:45
The metrics tab unfortunately only displays metrics for
-
5:48
paid apps, which will not be covered in this workshop.
-
5:52
But if you upgrade it's a cool thing to check out.
-
5:56
The activity tab here gives me a log of all of the app specific
-
6:01
actions that have been taken by me or my collaborators for this app.
-
6:05
Right now it doesn't show a whole lot,
-
6:07
it shows that we created an initial release of the app down here.
-
6:13
We enabled Logplex, which is done by default and we attached the database.
-
6:19
So yeah, that's the stuff I've don.
-
6:21
The first two actions are done automatically when we created the app,
-
6:23
the third is the database we just created out of the resources tab.
-
6:27
I know you all picked that up, this tab will also display our deploys
-
6:31
once we start deploying as well as in the other settings changes.
-
6:34
The access tab here lets us add collaborators, which is helpful if we want
-
6:39
other developers to be able to deploy and manage our application.
-
6:42
For now though the only collaborative that's listed should be
-
6:45
your Heroku account, and in my case it's this one.
-
6:49
And the last tab over here settings controls a whole range of configurations
-
6:54
for the Heroku app.
-
6:56
Here you can change the name of your app.
-
6:57
You can show config variables, you can change them as well.
-
7:01
You can add domains and you can even delete the app entirely,
-
7:05
if you come all the way down here.
-
7:07
You wanna delete it?
-
7:08
You can throw it away.
-
7:09
The part of this page that's relevant for this workshop is up here at the top,
-
7:13
this config variables section.
-
7:15
If you select the reveal config vars you'll see that Heroku added a URL,
-
7:21
it added this database URL in this string over here.
-
7:26
That's the connection string for the database.
-
7:29
Most of the secret configuration for
-
7:30
projects that get deployed on Heroku happens to reconfigure variables.
-
7:33
We'll be covering those more as this workshop goes on too.
-
7:37
There's one last thing to notice about the Heroku dashboard.
-
7:40
If you click open app, up in the top right corner the page,
-
7:43
you'll taken to a page showing your new empty app.
-
7:47
In the next video I'm gonna replace this placeholder page
-
7:49
with the actual Django project.
You need to sign up for Treehouse in order to download course files.
Sign up