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