Loading video player…

Create Your First Heroku App

For more information on concepts covered in this lesson, you can check out:

Here are the command-line snippets used in this lesson:

Shell
$ heroku create [<app-name>]
$ heroku destroy <app-name>
$ heroku apps
$ heroku open -a <app-name>

00:00 In this lesson, you’ll create your first Heroku app, which is an abstract container for your source code, dependencies, configuration, and metadata. By the end, you’ll have a publicly available domain address to host your web project.

00:14 You can start creating Heroku apps from your terminal right away. Just make sure that you’re logged in with the Heroku CLI. If you’re not, then check out the previous lesson.

00:25 Next, type heroku create and hit Enter. After a second or two, Heroku will have created a new app and have chosen a random name for it. This ensures that your app name is globally unique across the entire Heroku platform, making it possible to use the app name as a part of your domain name.

00:44 You can provide a custom app name too if you want to.

00:50 In this case, unfortunately, the name portfolio-project was already taken by someone else. Try another name—for example, by adding some prefix like real-python-.

01:03 This time, you’re lucky.

01:07 You can create at most five distinct apps with your free Heroku account, which should be plenty in the beginning. However, if you’d like to extend that limit to 100 apps, then you’ll need to verify your account by providing credit card details in your Heroku dashboard. This helps prevent abuse.

01:24 Keep in mind that verifying your account doesn’t automatically start charging you until you upgrade your plan or use paid add-ons. Apart from that, a verified account receives slightly more generous limits, so it might be worthwhile to consider after all. If, on the other hand, you wish to stay unverified and not disclose any of your payment details, then you can always delete one of your unused apps by typing heroku destroy followed by the app name.

01:58 It will prompt you to retype the name of the app since making a mistake at this point would be irreversible. Note that create and destroy are aliases to the relevant subcommands of the apps plugin.

02:13 There are a bunch of more app-related commands that you might find useful. For example, the open command will navigate your default web browser to the domain address of a given app. Let’s list your apps first

02:27 and open one by specifying its name.

02:36 Great! Congratulations. Your Heroku app is already live and responding to HTTP requests. What you see is a generic placeholder view provided by Heroku to let you know that your app is currently empty. In the next few lessons, you’ll learn how to deploy your Django project to a newly created app.

02:55 Before you go, however, you must know that Heroku puts your apps into sleep mode after thirty minutes of inactivity, so if your app doesn’t receive any network traffic within half an hour, then it might take a few extra seconds to wake up again the next time someone visits your app. That is the free accounts constraint, regardless of whether you verify yourself or not. All right, at this point, you got your feet wet with the Heroku platform, and now it’s time to dive deeper.

Become a Member to join the conversation.