-
Notifications
You must be signed in to change notification settings - Fork 119
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #76 from tecladocode/jose/cou-211-web-dev-re-creat…
…e-diff-store-links-for
- Loading branch information
Showing
54 changed files
with
84 additions
and
110 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,28 @@ | ||
--- | ||
title: What is Heroku? | ||
slug: what-is-heroku | ||
title: What do deployment services do for us? | ||
slug: what-do-deployment-services-do | ||
tags: | ||
- Concept | ||
- Published | ||
categories: | ||
- Presentation | ||
section_number: 8 | ||
excerpt: "Learn about what Heroku is and how it can help us share our application with users." | ||
section\_number: 8 | ||
excerpt: "Learn about what deployment services like Render.com do for us." | ||
draft: false | ||
--- | ||
|
||
# What is Heroku? | ||
# What do deployment services do for us? | ||
|
||
This is a presentation lecture without a transcript. For now, it's only available in the Udemy course! | ||
When we run our app, people and programs can make requests to the address the app is running on. When we run our app with `flask run`, this starts a development server which is in charge of receiving those requests and sending them over to the Flask app. The app then runs the Python function and calculates the response. | ||
|
||
For security reasons, when we run our app locally, people outside our network can't make requests to it. So if we want our app to be publicly available, we must deploy it somewhere that doesn't have this restriction. | ||
|
||
Deployment services companies like Render.com or Heroku, run our applications in publicly accessible services and they give us a URL that we can use to make requests to the application. | ||
|
||
These companies make it really easy to deploy our apps by taking care of provisioning hardware, setting it up, installing dependencies, etc. This kind of business is known as a PaaS: "Platform as a service." | ||
|
||
If you don't mind doing some more work yourself, for example by setting up each individual server, then you can save money by renting servers directly. The benefit of this is you can run multiple applications in a single server and you get more flexibility. This can save money, but takes a lot more work. Plus, PaaS applications can do things like restart our services if they crash, they can handle backups and deployments, and much more. Overall, I think using a PaaS makes a lot of sense, especially for smaller applications. | ||
|
||
Render.com has a generous free plan which means we can use their services for free. There are some limitations however. We only get 1500 hours per month, and builds are a bit slower than on paid plans (so when you deploy, it takes a few minutes for your application to run). | ||
|
||
Let's get started in the next lecture! |
60 changes: 7 additions & 53 deletions
60
curriculum/section08/lectures/04_getting_app_ready_for_heroku/README.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,67 +1,21 @@ | ||
--- | ||
title: Getting our app ready for Heroku | ||
slug: getting-our-app-ready-for-heroku | ||
title: Getting our app ready for Render | ||
slug: getting-our-app-ready-for-render | ||
tags: | ||
- Project | ||
- Published | ||
categories: | ||
- Video | ||
section_number: 8 | ||
excerpt: "Here we'll add some files that Heroku needs in order to run our application." | ||
excerpt: "Here we'll add some files that Render needs in order to run our application." | ||
draft: false | ||
--- | ||
|
||
- [Getting our app ready for Heroku](#getting-our-app-ready-for-heroku) | ||
- [The `runtime.txt` file](#the-runtimetxt-file) | ||
- [The `Procfile` file](#the-procfile-file) | ||
- [Install `gunicorn` in Heroku](#install-gunicorn-in-heroku) | ||
- [Getting our app ready for Render](#getting-our-app-ready-for-render) | ||
|
||
# Getting our app ready for Heroku | ||
# Getting our app ready for Render | ||
|
||
We need to tell Heroku: | ||
We need to add `gunicorn` to our `requirements.txt` file before we deploy to Render. | ||
|
||
- What language our app uses. | ||
- How to run our app. | ||
- The dependencies required for our app. | ||
You won't be able to run `gunicorn` in Windows, but you can install it. In other platforms, you should be able to run `gunicorn`. Either way, you'll be using `flask run` to run your app locally most of the time. We'll only use `gunicorn` in Render.com for performance benefits. | ||
|
||
We do this with three different files: | ||
|
||
- `runtime.txt`, for the language. | ||
- `Procfile`, for "how to run the app". | ||
- `requirements.txt`, for the dependencies. | ||
|
||
## The `runtime.txt` file | ||
|
||
Here we want to tell Heroku what language and what version to use. | ||
|
||
The contents of this file are very specific. You need to pick from the available languages and versions here: [https://devcenter.heroku.com/articles/python-runtimes](https://devcenter.heroku.com/articles/python-runtimes). | ||
|
||
In our case, we're going with this content inside the file: | ||
|
||
``` | ||
python-3.10.2 | ||
``` | ||
|
||
::: tip | ||
Other versions (e.g. older versions of Python) may also work. See this link for more information: https://devcenter.heroku.com/articles/python-support#supported-runtimes | ||
::: | ||
|
||
## The `Procfile` file | ||
|
||
::: warning | ||
The file should be called `Procfile`, and **not** `Procfile.txt`! | ||
::: | ||
|
||
Here we're going to tell Heroku how to run our app: | ||
|
||
``` | ||
web: gunicorn "app:create_app()" | ||
``` | ||
|
||
This uses the `web` dyno type, and in it executes the `gunicorn "app:create_app()"` command. That will start our app with `gunicorn` serving it. | ||
|
||
## Install `gunicorn` in Heroku | ||
|
||
We need to add `gunicorn` to our `requirements.txt` file before we deploy to Heroku. | ||
|
||
You won't be able to run `gunicorn` in Windows, but you can install it. In other platforms, you should be able to run `gunicorn`. Either way, you'll be using `flask run` to run your app locally most of the time. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.