Hint: You can adjust the default video playback speed in your account settings.
Hint: You can set the default subtitles language in your account settings.
Sorry! Looks like there’s an issue with video playback 🙁 This might be due to a temporary outage or because of a configuration issue with your browser. Please see our video player troubleshooting guide to resolve the issue.

Running a Web Application

00:00 Running a Web Application. In this section of the course, you’ll see what’s needed for a web application to run. Firstly, you’ll take a look at the HTTP Request-Response Cycle, which powers web applications. And then you’ll take a look at hosting, which is needed for your application to work on the Internet.

00:20 Serving dynamic content over the Internet involves a lot of different pieces, and they all have to communicate with one another to function correctly. Here’s a generalized overview of what takes place when a user interacts with a web application.

00:33 Sending: First, your user makes a request for a particular web page on your web app. They can do this, for example, by typing a URL into their browser. Receiving: The request gets received by the web server that hosts your website.

00:50 Matching: Your web server now uses a program to match the user’s request to a particular portion of your Python script. Running: The appropriate Python code is called up by that program.

01:02 When your code runs, it writes out a web page as a response. Delivering: The program then delivers this response back to your user through the web server. Viewing: Finally, the user can view the web server’s response. For example, the resulting web page can be displayed in a browser.

01:23 This is a general overview of how content is delivered over the Internet. The programming language used on the server, as well as the technologies to establish that connection, can differ. However, the concept used to communicate across HTTP requests and responses remains the same and is called the HTTP Request-Response Cycle.

01:44 Flask will handle most of this complexity for you, but it can help to keep a loose understanding of this process in mind. To allow Flask to handle requests on the server side, you’ll need to find a place where your Python code can live online.

01:58 Storing your code online to run a web application is called web hosting, and there are a number of providers offering paid and free web hosting. When choosing a web hosting provider, you need to confirm that it supports running Python code.

02:12 Many of them cost money, but this course will stick with a free option that’s professional and highly scalable yet still reasonable to set up:

02:21 Google App Engine.

02:24 Google App Engine enforces daily quotas for each application. If your web application exceeds these quotas, then Google will start billing you. If you’re a new Google Cloud customer, then you can get a free promotional credit when signing up.

02:39 There are a number of other free options, such as PythonAnywhere, Repl.it, or Heroku, that you can explore later on. Using Google App Engine will give you a good start in learning about deploying Python code to the web as it strikes a balance between abstracting away complexity and allowing you to customize the setup.

03:00 Google App Engine is part of the Google Cloud Platform, GCP, which is run by Google and represents one of the big cloud providers, along with Microsoft Azure and Amazon Web Services.

03:12 To get started with GCP, download and install the Google Cloud SDK for your operating system. For additional guidance beyond what you’ll find in this course, you can consult Google App Engine’s documentation by the link seen on-screen.

03:28 The Google Cloud SDK installation also includes a command-line program called gcloud, which you’ll later use to deploy your web app. Once you’re done with the installation, you can verify that everything worked by typing the following command into your console.

03:45 You should receive a text output in your terminal that looks similar to the one seen on-screen. Your version numbers will probably be different, but as long as the gcloud program is successfully found on your computer, your installation was successful.

03:59 With this high-level overview of concepts in mind and the Google Cloud SDK installed, you’re ready to set up a Python project that you’ll later deploy to the Internet. So let’s get started with that in the next section.

Become a Member to join the conversation.