Heads up! To view this whole video, sign in with your Courses account or enroll in your free 7-day trial. Sign In Enroll
Preview
Start a free Courses trial
to watch this video
In this final video, we’ll cover hosting our portfolio for free on render.com.
Resources
- Deploy a Flask App on Render | Docs
- Join the Treehouse Discord!
Next Steps
Take your Portfolio and knowledge even further with these additional Python courses:
Related Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign upRelated Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign up
Welcome back.
0:00
In this video, we'll cover getting our
portfolio live hosted on render.com.
0:01
That way, you can showcase your
stellar work with everyone.
0:06
Let's take a quick peek at
the Render documentation.
0:10
All right it looks like Render utilizes
the G unicorn python web server, package.
0:14
We'll need to install that
in our project as well then.
0:21
Perfect, it looks like they're
also assigning the name
0:24
space to a variable named app,
just like we are, okay.
0:29
For step two, we'll need to remember
to create a new web service on render.
0:33
And for step 3, it appears that we will
need to create a requirements.txt file,
0:40
so that render will know what Python
packages our project utilizes.
0:45
Then, instead of running python3
app.py like we would locally,
0:50
we will need to have the render start
command use g-unicorn-app, colon-app.
0:54
The app on the left side of
the colon is the name of the file.
1:00
The app on the right side is the variable
name that the namespace is assigned to.
1:03
Good to know.
1:08
Render will automatically rebuild the
deployment when you push changes to your
1:09
GitHub repo.
1:13
It even has a failsafe if
the redeployment fails.
1:14
Let's head back to VS code and
stop our local server then we can install
1:17
the G unicorn package with
pip install G unicorn.
1:22
Awesome.
1:29
Now, that we have installed
G unicorn into our project,
1:30
we can create a requirements.txt file,
which will contain a list of
1:33
the dependencies that need to be
installed to run our portfolio.
1:38
We can create it by typing pip
freeze > requirements.txt.
1:42
Let's take a peek inside of
the requirements.txt file to make sure
1:52
it includes flask and G unicorn.
1:57
Perfect it does.
1:59
Now we just need to update our repo and
push these changes to GitHub.
2:02
That way, we will be able to use the repo
to deploy directly to render.com.
2:06
Let's head to the browser and
go to render.com.
2:14
All right, let's get started.
2:18
Just like with Replit,
we'll sign up using Github Oauth.
2:22
Yep, we'll authorize render and
complete the sign up.
2:30
Let me quickly verify my email.
2:37
I'm just going to Is going to answer
this single required question.
2:38
Feel free to pause me and
fully populate the form.
2:43
If you remember from
the render documentation,
2:49
a Python Flask app will need
to run as a web service.
2:52
So let's create a new web service.
2:54
Just like with Repl.it, we can deploy
directly from our GitHub repo.
3:01
Let's get it connected.
3:05
Again, like Repl.it,
3:09
render gives us the option to select
all repositories or just specific ones.
3:11
In this case, we just want the Portfolio
repo to be visible to render for
3:18
installation Let me quickly
confirm my GitHub password.
3:22
Excellent.
3:36
It found the repo time to connect it
3:36
I'll give it a Simple name
of Brian's Python portfolio.
3:43
Let's scroll down and
see what other options there are.
3:48
Wonderful.
3:52
It pre populated the build and start
commands that we saw in the documentation.
3:53
Let's choose the free tier.
3:59
It looks like it has a few limitations
compared to the paid plans,
4:01
but it'll be more than enough for
our needs.
4:05
We won't need environment variables for
this project, so
4:08
we'll scroll down further.
4:11
Great, all the options we need are set.
4:13
Let's create the instance.
4:15
It will take a little bit for
the instance to spin up and build.
4:17
Let's take a look at it going
through the build process.
4:21
Awesome, the build was successful.
4:35
Let's scroll back up and wait for the in
progress status to change to live for
4:37
the deployment.
4:42
It's live, let's visit the link.
4:48
And there we have it.
4:55
Our portfolio live on the Internet.
4:56
I can't wait to see your portfolios, so
4:59
make sure to share them
in the treehouse discord.
5:01
I'll see you next time.
5:04
You need to sign up for Treehouse in order to download course files.
Sign upYou need to sign up for Treehouse in order to set up Workspace
Sign up