flask程序打包部署

by Salvador Villalon

萨尔瓦多·维拉隆(Salvador Villalon)

介绍 (Introduction)

In each section, I will show pieces of code for you to follow along. All the code used in the tutorial is available in this GitHub Repository.

在每个部分中,我将显示一些代码供您遵循。 本教程中使用的所有代码都可以在GitHub Repository中找到 。

什么是HTTP,它与Flask有什么关系? (What is HTTP and What Does it Have to do with Flask?)

HTTP is the protocol for websites. The internet uses it to interact and communicate with computers and servers. Let me give you an example of how you use it everyday.

HTTP是网站的协议。 互联网使用它与计算机和服务器进行交互和通信。 让我举一个例子,说明您每天如何使用它。

When you type the name of a website in the address bar of your browser and you hit enter. What happens is that an HTTP request has been sent to a server.

在浏览器的地址栏中键入网站名称时,按Enter键。 发生的情况是HTTP请求已发送到服务器。

For example, when I go to my address bar and type google.com, then hit enter, an HTTP request is sent to a Google Server. The Google Server receives the request and needs to figure how to interpret that request. The Google Server sends back an HTTP response that contains the information that my web browser receives. Then it displays what you asked for on a page in the browser.

例如,当我转到地址栏并键入google.com,然后按Enter键时,HTTP请求将发送到Google服务器。 Google服务器接收到该请求,并需要弄清楚如何解释该请求。 Google服务器发回一个HTTP响应,其中包含我的网络浏览器收到的信息。 然后,它在浏览器的页面上显示您要的内容。

Flask如何参与? (How is Flask involved?)

We will write code that will take care of the server side processing. Our code will receive requests. It will figure out what those requests are dealing with and what they are asking. It will also figure out what response to send to the user.

我们将编写代码来处理服务器端的处理。 我们的代码将收到请求。 它将弄清楚那些请求正在处理什么以及它们在问什么。 它还将找出发送给用户的响应。

To do all this we will use Flask.

为此,我们将使用Flask。

什么是烧瓶? (What is Flask?)

It makes the process of designing a web application simpler. Flask lets us focus on what the users are requesting and what sort of response to give back.

它使设计Web应用程序的过程更加简单。 烧瓶让我们专注 关于用户的要求以及回馈的方式。

Learn more about micro frameworks.

了解有关微框架的更多信息。

Flask应用程序如何工作? (How Does a Flask App Work?)

The code lets us run a basic web application that we can serve, as if it were a website.

该代码使我们可以运行一个可以服务的基本Web应用程序,就像它是一个网站一样。

from flask import Flaskapp = Flask(__name__)@app.route("/")
def home():return "Hello, World!"if __name__ == "__main__":app.run(debug=True)

This piece of code is stored in our main.py.

这段代码存储在我们的main.py中。

Line 1: Here we are importing the Flask module and creating a Flask web server from the Flask module.

第1行:在这里,我们导入Flask模块,并从Flask模块创建Flask Web服务器。

Line 3: __name__ means this current file. In this case, it will be main.py. This current file will represent my web application.

第3行:__name__表示当前文件 。 在这种情况下,它将是main.py。 当前文件将代表我的Web应用程序。

We are creating an instance of the Flask class and calling it app. Here we are creating a new web application.

我们正在创建Flask类的实例,并将其称为app。 在这里,我们正在创建一个新的Web应用程序。

Line 5: It represents the default page. For example, if I go to a website such as “google.com/” with nothing after the slash. Then this will be the default page of Google.

第5行:它代表默认页面。 例如,如果我转到“ google.com/”之类的网站后,斜杠后一无所有。 然后,这将是Google的默认页面。

Line 6–7: When the user goes to my website and they go to the default page (nothing after the slash), then the function below will get activated.

第6–7行 :当用户访问我的网站并转到默认页面(斜杠后没有其他字符)时,下面的功能将被激活。

Line 9: When you run your Python script, Python assigns the name “__main__” to the script when executed.

第9行:运行Python脚本时,Python在执行时会为脚本分配名称“ __main__”。

If we import another script, the if statement will prevent other scripts from running. When we run main.py, it will change its name to __main__ and only then will that if statement activate.

如果我们导入另一个脚本,则if语句将阻止其他脚本运行。 当我们运行main.py时,它将名称更改为__main__,然后if语句激活。

Line 10: This will run the application. Having debug=True allows possible Python errors to appear on the web page. This will help us trace the errors.

第10行:这将运行应用程序。 使用debug=True可使可能的Python错误显示在网页上。 这将帮助我们跟踪错误。

让我们尝试运行main.py (Let’s Try Running main.py)

In your Terminal or Command Prompt go to the folder that contains your main.py. Then do py main.py or python main.py. In your terminal or command prompt you should see this output.

在终端或命令提示符下,转到包含main.py的文件夹。 然后做py main.pypython main.py 在终端或命令提示符下,您应该看到此输出。

The important part is where it says Running on http://127.0.0.1:5000/.

重要的部分是它说Running on http://127.0.0.1:5000/

127.0.0.1 means this local computer. If you do not know the meaning of this (like I didn’t when I started — this article is really helpful), the main idea is that 127.0.0.1 and localhost refer to this local computer.

127.0.0.1表示此本地计算机。 如果您不知道它的含义(例如我刚开始时并不了解— 这篇文章确实有帮助 ),则主要思想是127.0.0.1和localhost引用此本地计算机。

Go to that address and you should see the following:

转到该地址,您应该看到以下内容:

Flask带来更多乐趣 (More Fun with Flask)

Earlier you saw what happened when we ran main.py with one route which was app.route(“/”).

之前,您看到了当我们使用一个名为app.route(“ /”)的路由运行main.py时发生的情况。

Let’s add more routes so you can see the difference.

让我们添加更多路线,以便您可以看到不同之处。

from flask import Flaskapp = Flask(__name__)@app.route("/")
def home():return "Hello, World!"@app.route("/salvador")
def salvador():return "Hello, Salvador"if __name__ == "__main__":app.run(debug=True)

In lines 9–11. we added a new route, this time to /salvador.

9-11行中 。 我们这次添加了一条新路线到/ salvador。

Now run the main.py again and go to http://localhost:5000/salvador.

现在再次运行main.py并转到 http:// localhost:5000 / salvador 。

So far we have been returning text. Let’s make our website look nicer by adding HTML and CSS.

到目前为止,我们一直在返回文本。 通过添加HTML和CSS,使我们的网站看起来更好。

HTML,CSS和虚拟环境 (HTML, CSS, and Virtual Environments)

Flask中HTML和模板 (HTML and Templates in Flask)

First create a new HTML file. I called mine home.html.

首先创建一个新HTML文件。 我叫我的home.html。

Here is some code to get you started.

这是一些使您入门的代码。

<!DOCTYPE html>
<html lang="en" dir="ltr"><head><meta charset="utf-8"><title>Flask Tutorial</title></head><body><h1> My First Try Using Flask </h1><p> Flask is Fun </p></body>
</html>

要记住的重点 (Important Point To Remember)

The Flask Framework looks for HTML files in a folder called templates. You need to create a templates folder and put all your HTML files in there.

Flask框架在名为模板的文件夹中查找HTML文件需要创建一个模板文件夹,并将所有HTML文件放在其中。

Now we need to change our main.py so that we can view the HTML file we created.

现在,我们需要更改main.py,以便可以查看创建HTML文件。

from flask import Flask, render_template      app = Flask(__name__)@app.route("/")
def home():return render_template("home.html")@app.route("/salvador")
def salvador():return "Hello, Salvador"if __name__ == "__main__":app.run(debug=True)We made two new changes

Line 1: We imported render_template() method from the flask framework. render_template() looks for a template (HTML file) in the templates folder. Then it will render the template for which you ask. Learn more about render_templates() function.

第1行:我们从flask框架导入了render_template()方法。 render_template()在模板文件夹中查找模板(HTML文件)。 然后它将呈现您要求的模板。 了解有关render_templates()函数的更多信息。

Line 7: We change the return so that now it returns render_template(“home.html”). This will let us view our HTML file.

第7行:我们更改了返回值,以使其现在返回render_template(“home.html”) 。 这将使我们查看我们HTML文件。

Now visit your localhost and see the changes: http://localhost:5000/.

现在访问您的localhost并查看更改: http:// localhost:5000 / 。

让我们添加更多页面 (Let’s add more pages)

Let’s create an about.html inside the templates folder.

让我们在模板文件夹中创建一个about.html

<!DOCTYPE html>
<html lang="en" dir="ltr"><head><meta charset="utf-8"><title>About Flask</title></head><body><h1> About Flask </h1><p> Flask is a micro web framework written in Python.</p><p> Applications that use the Flask framework include Pinterest,LinkedIn, and the community web page for Flask itself.</p></body>
</html>

Let’s make a change similar to what we did before to our main.py.

让我们进行与之前对main.py所做的更改类似的更改。

from flask import Flask, render_templateapp = Flask(__name__)@app.route("/")
def home():return render_template("home.html")@app.route("/about)
def about():return render_template("about.html")if __name__ == "__main__":app.run(debug=True)

We made three new changes:

我们进行了三项新更改:

Line 9: Change the route to"/about".

第9行:将路线更改为"/about "

Line 10: Change the function so it is now def about():

第10行:更改功能,现在就可以了 def about():

Line 11: Change the return so that now it returns render_template("about.html").

第11行:更改返回值,以使其现在返回render_template("about.html")

Now see the changes: http://localhost:5000/about.

现在查看更改: http:// localhost:5000 / about 。

让我们通过导航连接两个页面 (Let’s Connect Both Pages with a Navigation)

To connect both pages we can have a navigation menu on the top. We can use Flask to make the process of creating a navigation menu easier.

要连接两个页面,我们可以在顶部有一个导航菜单。 我们可以使用Flask简化创建导航菜单的过程。

First, let’s create a template.html. This template.html will serve as a parent template. Our two child templates will inherit code from it.

首先,让我们创建一个template.html。template.html将用作父模板。 我们的两个子模板将从其继承代码。

<!DOCTYPE html>
<html lang="en" dir="ltr"><head><meta charset="utf-8"><title>Flask Parent Template</title><link rel="stylesheet" href="{{ url_for('static',     filename='css/template.css') }}"></head><body><header><div class="container"><h1 class="logo">First Web App</h1><strong><nav><ul class="menu"><li><a href="{{ url_for('home') }}">Home</a></li><li><a href="{{ url_for('about') }}">About</a></li></ul></nav></strong></div></header>{% block content %}{% endblock %}</body>
</html>

Line 13–14: We use the function called url_for(). It accepts the name of the function as an argument. Right now we gave it the name of the function. More information on url_for() function.

第13-14行:我们使用了称为 url_for() 它接受函数名称作为参数。 现在我们给它起函数的名字。 有关url_for()函数的更多信息

The two lines with the curly brackets will be replaced by the content of home.html and about.html. This will depend on the URL in which the user is browsing.

带有大括号的两行将替换为home.html和about.html的内容。 这将 取决于用户正在浏览的URL。

These changes allow the child pages (home.html and about.html) to connect to the parent (template.html). This allows us to not have to copy the code for the navigation menu in the about.html and home.html.

这些更改允许子页面(home.html和about.html)连接到父页面(template.html)。 这使我们不必复制about.html和home.html中导航菜单的代码。

Content of about.html:

about.html的内容:

<!DOCTYPE html>
<html lang="en" dir="ltr"><head><meta charset="utf-8"><title>About Flask</title></head><body>{% extends "template.html" %}{% block content %}<h1> About Flask </h1><p> Flask is a micro web framework written in Python.</p><p> Applications that use the Flask framework include Pinterest,LinkedIn, and the community web page for Flask itself.</p>{% endblock %}</body>
</html>

Content of home.html:

home.html的内容:

<!DOCTYPE html>
<html lang="en" dir="ltr"><head><meta charset="utf-8"><title>Flask Tutorial</title></head><body>{% extends "template.html" %}{% block content %}<h1> My First Try Using Flask </h1><p> Flask is Fun </p>{% endblock %}</body>
</html>

Let’s try adding some CSS.

让我们尝试添加一些CSS。

将CSS添加到我们的网站 (Adding CSS to Our Website)

要记住的重要注意事项 (An important note to remember)

In the same way as we created a folder called templates to store all our HTML templates, we need a folder called static.

与创建一个名为template的文件夹以存储所有HTML模板的方式相同,我们需要一个名为static的文件夹。

In static, we will store our CSS, JavaScript, images, and other necessary files. That is why it is important that you should create a CSS folder to store your stylesheets. After you do this, your project folder should look like this:

static中 ,我们将存储CSS,JavaScript,图像和其他必要的文件。 这就是为什么您必须创建一个CSS 文件夹来存储样式表的原因。 完成此操作后,您的项目文件夹应如下所示:

将我们CSS与我们HTML文件链接 (Linking our CSS with our HTML file)

Our template.html is the one that links all pages. We can insert the code here and it will be applicable to all child pages.

我们的template.html是链接所有页面的模板。 我们可以在此处插入代码,它将适用于所有子页面。

<!DOCTYPE html>
<html lang="en" dir="ltr"><head><meta charset="utf-8"><title>Flask Parent Template</title><link rel="stylesheet" href="{{ url_for('static',    filename='css/template.css') }}"></head><body><header><div class="container"><h1 class="logo">First Web App</h1><strong><nav><ul class="menu"><li><a href="{{ url_for('home') }}">Home</a></li><li><a href="{{ url_for('about') }}">About</a></li></ul></nav></strong></div></header>{% block content %}
{% endblock %}</body>
</html>

Line 7: Here we are giving the path to where the template.css is located.

第7行:此处提供了template.css所在位置的路径。

Now see the changes: http://localhost:5000/about.

现在查看更改: http:// localhost:5000 / about 。

使用Flask和virtualenv前进 (Moving Forward with Flask and virtualenv)

Now that you are familiar with using Flask, you may start using it in your future projects. One thing to always do is use virtualenv.

现在您已经熟悉了Flask的使用,您可以在以后的项目中开始使用它。 始终要做的一件事是使用virtualenv。

为什么要使用virtualenv? (Why use virtualenv?)

You may use Python for others projects besides web-development.

您可以将Python用于网络开发以外的其他项目。

Your projects might have different versions of Python installed, different dependencies and packages.

您的项目可能安装了不同版本的Python,不同的依赖项和软件包。

We use virtualenv to create an isolated environment for your Python project. This means that each project can have its own dependencies regardless of what dependencies every other project has.

我们使用virtualenv为您的Python项目创建一个隔离的环境。 这意味着每个项目都可以具有自己的依赖关系,而不管每个其他项目都具有什么依赖关系。

virtualenv入门 (Getting started with virtualenv)

First, run this command on your command prompt or terminal:

首先,在命令提示符或终端上运行以下命令:

pip install virtualenv

Second, do the following:

其次,执行以下操作:

virtualenv “name of virtual environment”

Here you can give a name to the environment. I usually give it a name of virtual. It will look like this: virtualenv virtual.

您可以在此处为环境命名。 我通常给它起一个虚拟的名字。 它看起来像这样: virtualenv virtual

After setting up virtual environment, check your project folder. It should look like this. The virtual environment needs to be created in the same directory where your app files are located.

设置虚拟环境后,检查您的项目文件夹。 它应该看起来像这样。 需要在应用程序文件所在的目录中创建虚拟环境

激活虚拟环境 (Activating the virtual environment)

Now go to your terminal or command prompt. Go to the directory that contains the file called activate. The file called activate is found inside a folder called Scripts for Windows and bin for OS X and Linux.

现在转到终端或命令提示符。 转到包含名为Activate的文件的目录 所谓激活文件是Windows文件夹,名为脚本斌为OS X和Linux里面找到

For OS X and Linux Environment:

对于OS X和Linux环境:

$ name of virtual environmnet/bin/activate

For Windows Environment:

对于Windows环境:

name of virtual environment\Scripts\activate

Since I am using a Windows machine, when I activate the environment it will look like this:

由于我使用的是Windows计算机,因此当我激活环境时,它将如下所示:

The next step is to install flask on your virtual environment so that we can run the application inside our environment. Run the command:

下一步是在您的虚拟环境中安装flask,以便我们可以在环境中运行该应用程序。 运行命令:

pip install flask

Run your application and go to http://localhost:5000/

运行您的应用程序,然后转到http:// localhost:5000 /

We finally made our web application. Now we want to show the whole world our project.

我们终于制作了我们的Web应用程序。 现在,我们想向全世界展示我们的项目。

(More information on virtualenv can be found in the following guides on virtualenv and Flask Official Documentation)

(有关virtualenv的更多信息,请参见以下有关virtualenv和Flask官方文档的指南)

让我们将其发送到云端 (Let’s send it to the Cloud)

To show others the project we made, we will need to learn how to use Cloud Services.

为了向其他人展示我们所做的项目,我们将需要学习如何使用Cloud Services。

将您的Web应用程序部署到云中 (Deploy Your Web Application to the Cloud)

To deploy our web application to the cloud, we will use Google App Engine (Standard Environment). This is an example of a Platform as a Service (PaaS).

要将我们的Web应用程序部署到云中,我们将使用Google App Engine (标准环境)。 这是平台即服务(PaaS)的示例

PaaS refers to the delivery of operating systems and associated services over the internet without downloads or installation. The approach lets customers create and deploy applications without having to invest in the underlying infrastructure (More info on PaaS check out TechTarget).

PaaS是指通过Internet交付操作系统和相关服务而无需下载或安装 。 该方法使客户可以创建和部署应用程序,而不必投资基础架构(有关PaaS的更多信息,请查看TechTarget )。

Google App Engine is a platform as a service offering that allows developers and businesses to build and run applications using Google’s advanced infrastructure — TechOpedia.

Google App Engine是一个平台即服务产品,允许开发人员和企业使用Google的高级基础架构TechOpedia构建和运行应用程序。

在你开始前: (Before you Start:)

You will need a Google Account. Once you create an account, go to the Google Cloud Platform Console and create a new project. Also, you need to install the Google Cloud SDK.

您将需要一个Google帐户 创建帐户后,转到Google Cloud Platform Console并创建一个新项目。 另外,您需要安装Google Cloud SDK 。

At the end of this tutorial your project structure will look like this.

在本教程的最后,您的项目结构将如下所示。

We will need to create three new files: app.yaml, appengine_config.py, and requirements.txt.

我们将需要创建三个新文件:app.yaml,appengine_config.py和requirements.txt。

Content of app.yaml:

app.yaml的内容:

runtime: python27
api_version: 1
threadsafe: truehandlers:
- url: /staticstatic_dir: static
- url: /.*script: main.applibraries:- name: sslversion: latest

If you were to check Google’s Tutorial in the part where they talk about content of the app.yaml, it does not include the section where I wrote about libraries.

如果您要在他们谈论app.yaml的内容中查看Google的教程 ,则不包括我写过的库部分。

When I first attempted to deploy my simple web app, my deployment never worked. After many attempts, I learned that we needed to include the SSL library.

当我第一次尝试部署简单的Web应用程序时,我的部署从未奏效。 经过多次尝试,我了解到我们需要包括SSL库。

The SSL Library allows us to create secure connections between the client and server. Every time the user goes to our website they will need to connect to a server run by Google App Engine. We need to create a secure connection for this. (I recently learned this, so if you have a suggestions for this let me know!)

SSL库允许我们在客户端和服务器之间创建安全连接 。 每次用户访问我们的网站时,他们都需要连接到由Google App Engine运行的服务器。 我们需要为此创建一个安全连接。 (我最近才学到这一点,所以如果您对此有任何建议,请告诉我!)

Content of appengine_config.py:

appengine_config.py的内容:

from google.appengine.ext import vendor# Add any libraries installed in the "lib" folder.
vendor.add('lib')

Content of requirements.txt:

Requirements.txt的内容:

Flask
Werkzeug

Now inside our virtual environment (make sure your virtualenv is activated), we are going to install the new dependencies we have in requirements.txt. Run this command:

现在在我们的虚拟环境中(确保您的virtualenv已激活) , 我们将安装Requirements.txt中的新依赖项。 运行以下命令:

pip install -t lib -r requirements.txt

-t lib: This flag copies the libraries into a lib folder, which uploads to App Engine during deployment.

-t lib:此标志将库复制到lib文件夹,该文件夹在部署期间上传到App Engine。

-r requirements.txt: Tells pip to install everything from requirements.txt.

-r requirements.txt:告诉pip安装Requirements.txt中的所有内容。

部署应用 (Deploying the Application)

To deploy the application to Google App Engine, use this command.

要将应用程序部署到Google App Engine,请使用此命令。

gcloud app deploy

I usually include — project [ID of Project]

我通常包括— 项目[Project ID]

This specifies what project you are deploying. The command will look like this:

这指定您要部署的项目。 该命令将如下所示:

gcloud app deploy --project [ID of Project]

应用程序 (The Application)

Now check the URL of your application. The application will be store in the following way:

现在检查您的应用程序的URL。 该应用程序将通过以下方式存储:

"your project id".appspot.com

My application is here: http://sal-flask-tutorial.appspot.com

我的应用程序在这里: http : //sal-flask-tutorial.appspot.com

结论 (Conclusion)

From this tutorial, you all learned how to:

从本教程中,你们所有人都学会了如何:

  • Use the framework called Flask to use Python as a Server Side Language.使用称为Flask的框架将Python用作服务器端语言。
  • Learned how to use HTML, CSS, and Flask to make a website.了解了如何使用HTML,CSS和Flask创建网站。
  • Learned how to create Virtual Environments using virtualenv.了解了如何使用virtualenv创建虚拟环境。
  • Use Google App Engine Standard Environment to deploy an application to the cloud.使用Google App Engine标准环境将应用程序部署到云中。

我学到的是 (What I learned)

I learned three important things from this small project.

我从这个小项目中学到了三件事。

First, I learned about the difference between a static website and a web application

首先,我了解了静态网站和Web应用程序之间的区别

Static Websites:

静态网站:

  • Means that the server is serving HTML, CSS, and JavaScript files to the client. The content of the site does not change when the user interacts with it.表示服务器正在向客户端提供HTML,CSS和JavaScript文件。 用户与之交互时,该站点的内容不会更改。

Web Applications:

网络应用程序:

  • A web application or dynamic website generates content based on retrieved data (most of the time is a database) that changes based on a user’s interaction with the site. In a web application, the server is responsible for querying, retrieving, and updating data. This causes web applications to be slower and more difficult to deploy than static websites for simple applications (Reddit).

    Web应用程序或动态网站会根据检索到的数据(大多数情况下是数据库)来生成内容,这些数据会根据用户与网站的互动而变化。 在Web应用程序中,服务器负责查询,检索和更新数据。 与简单应用程序的静态网站( Reddit )相比,这导致Web应用程序更慢且更难以部署。

Server Side and Client Side:

服务器端和客户端:

  • I learned that a web application has two sides. The client side and the server side. The client side is what the user interacts with and the server side is where the all the information that the user inputted is processed.我了解到Web应用程序有两个方面。 客户端和服务器端。 客户端是用户交互的对象,服务器端是用户输入的所有信息的处理位置。

Second, I learned about Cloud Services

其次,我了解了云服务

Most of my previous projects were static websites, and to deploy them I used GitHub Pages. GitHub Pages is a free static site hosting service designed to host projects from a GitHub Repository.

我之前的大多数项目都是静态网站,并且使用GitHub Pages进行部署。 GitHub Pages是一项免费的静态站点托管服务,旨在托管GitHub Repository中的项目。

When working with web applications, I could not use GitHub Pages to host them. GitHub Pages is only meant for static websites not for something dynamic like a web application that requires a server and a database. I had to use Cloud Services such as Amazon Web Services or Heroku

使用Web应用程序时,我无法使用GitHub Pages托管它们。 GitHub Pages仅适用于静态网站,不适用于需要服务器和数据库的动态应用程序(如Web应用程序)。 我必须使用Amazon Web Services或Heroku等云服务

Third, I learned how to use Python as a Server Side Language

第三,我学习了如何将Python用作服务器端语言

To create the server side of the web application we had to use a server side language. I learned that I could use the framework called Flask to use Python as the Server Side Language.

要创建Web应用程序的服务器端,我们必须使用服务器端语言。 我了解到可以使用名为Flask的框架将Python用作服务器端语言。

下一步: (Next Steps:)

You can build all sorts of things with Flask. I realized that Flask helps make the code behind the website easier to read. I have made the following applications during this summer of 2018 and I hope to make more.

您可以使用Flask构建各种东西。 我意识到Flask有助于使网站背后的代码更易于阅读。 我在2018年这个夏天提出了以下申请,希望能做得更多。

Personal Projects

个人项目

  • A Twilio SMS App

    Twilio短信应用

  • My Personal Website

    我的个人网站

During my internship

在我实习期间

  • Part of a project where I learned about Docker and Containers

    我了解Docker和Containers的项目的一部分

Here is the list of resources that helped me create this tutorial:

以下是帮助我创建本教程的资源列表:

  • “App Engine — Build Scalable Web & Mobile Backends in Any Language | App Engine | Google Cloud.” Google, Google, cloud.google.com/appengine/.

    “ App Engine —以任何语言构建可扩展的Web和移动后端| App Engine | Google Cloud。” Google ,Google, cloud.google.com/appengine/ 。

  • “Building a Website with Python Flask.” PythonHow, pythonhow.com/building-a-website-with-python-flask/.

    “使用Python Flask构建网站。” PythonHow , pythonhow.com / building-a-website-with-python-flask / 。

  • “Flask — Lecture 2 — CS50’s Web Programming with Python and JavaScript.” YouTube, 6 Feb. 2018, youtu.be/j5wysXqaIV8.

    “烧瓶-第2课-CS50使用Python和JavaScript进行Web编程。” YouTube ,2018年2月6日, youtu.be / j5wysXqaIV8 。

  • “Getting Started with Flask on App Engine Standard Environment | App Engine Standard Environment for Python | Google Cloud.” Google, Google, cloud.google.com/appengine/docs/standard/python/getting-started/python-standard-env.

    “ App Engine标准环境上的Flask入门| 适用于Python的App Engine标准环境| Google Cloud。” Google ,Google, cloud.google.com/appengine/docs/standard/python/getting-started/python-standard-env 。

  • “Installation.” Welcome | Flask (A Python Microframework), flask.pocoo.org/docs/0.12/installation/.

    “安装。” 欢迎光临| Flask(Python Microframework ) , flask.pocoo.org / docs / 0.12 / installation / 。

  • “Python — Deploying Static Flask Sites for Free on Github Pages.” Reddit, www.reddit.com/r/Python/comments/1iewqt/deploying_static_flask_sites_for_free_on_github/.

    “ Python —在Github Pages上免费部署静态Flask网站。” Reddit , www.reddit.com/r/Python/comments/1iewqt/deploying_static_flask_sites_for_free_on_github/。

  • Real Python. “Python Virtual Environments: A Primer — Real Python.” Real Python, Real Python, 7 Aug. 2018, realpython.com/python-virtual-environments-a-primer/.

    真正的Python。 “ Python虚拟环境:入门-真正的Python。” Real Python ,Real Python,2018年8月7日, realpython.com/python-virtual-environments-a-primer/ 。

  • “What Is Cloud Services? — Definition from WhatIs.com.” SearchITChannel, searchitchannel.techtarget.com/definition/cloud-services.

    “什么是云服务? —来自WhatIs.com的定义。” SearchITChannel , searchitchannel.techtarget.com/ definition / cloud-services 。

  • “What Is Google App Engine (GAE)? — Definition from Techopedia.” Techopedia.com, www.techopedia.com/definition/31267/google-app-engine-gae.

    “什么是Google App Engine(GAE)? —来自Techopedia的定义。” Techopedia.com , www.techopedia.com/ definition/31267/google-app-engine-gae

If you have any suggestions or questions, feel free to leave a comment.

如果您有任何建议或问题,请随时发表评论。

翻译自: https://www.freecodecamp.org/news/how-to-build-a-web-application-using-flask-and-deploy-it-to-the-cloud-3551c985e492/

flask程序打包部署

flask程序打包部署_如何使用Flask构建Web应用程序并将其部署到云中相关推荐

  1. 【使用Blazor构建web应用程序 .NET 6篇 上】

    Build web applications with Blazor 使用Blazor构建web应用程序 .NET 6篇 上 使用Blazor构建web应用程序 第一节Introduction (介绍 ...

  2. 【使用Blazor构建web应用程序 .NET 6篇 中】

    Build web applications with Blazor 使用Blazor构建web应用程序 .NET 6篇 中 使用Blazor构建web应用程序 第五节Exercise - Acces ...

  3. node.js 静态属性_如何使用静态站点和Node.js开发和部署第一个全栈式Web应用程序

    node.js 静态属性 This tutorial will show you how to convert a static website that uses HTML, CSS and Jav ...

  4. idea自动构建web项目_构建Web应用程序以自动执行系统管理员任务

    idea自动构建web项目 系统管理员(sysadmin)每年在重复性任务上浪费数千小时. 幸运的是,使用开源工具构建的Web应用程序可以自动消除很大一部分痛苦. 例如,使用Python和JavaSc ...

  5. java web底层原理_详解Java开发Web应用程序的底层原理

    前言 前面一篇文章,我从整个应用程序的整体以及跟运行环境的关系简单聊了一下我们现在常用的Spring框架的设计基础和准则,其中主要是控制反转和依赖注入,以及容器化编程等概念. 这里我不想去复述这些概念 ...

  6. ic卡写卡 angus_使用Angus更快地构建Web应用程序

    ic卡写卡 angus Nick's outstanding utility, Angus, has changed! Click here to read an updated post! 尼克杰出 ...

  7. Qt Creator构建Web应用程序

    Qt Creator构建Web应用程序 构建Web应用程序 要求 搭建开发环境 为WebAssembly设置Qt 启用WebAssembly插件 指定WebAssembly设置 添加WebAssemb ...

  8. 了解如何使用ASP.NET Core 3.1构建Web应用程序

    ASP.NET Core is an open source web-development framework for building web apps on the .NET platform. ...

  9. python flask源码解析_浅谈flask源码之请求过程

    Flask Flask是什么? Flask是一个使用 Python 编写的轻量级 Web 应用框架, 让我们可以使用Python语言快速搭建Web服务, Flask也被称为 "microfr ...

最新文章

  1. Basic005. Intro to statistics basic terms统计名词介绍
  2. PDF文件修改后,保存时出现:文档无法保存。读取文档时出现问题(135)
  3. 共轭梯度下降法matlab,用matlab实现最速下降法,牛顿法和共轭梯度法求解实例
  4. MySQL 架构组成—存储引擎
  5. 阿里开源新一代人机对话模型 ESIM:准确率打破世界纪录,提升至 94.1%!
  6. 小白都看得懂的监督学习与无监督学习
  7. rfc 查看工具_用于系统管理员的杀手级工具,Skype替代品,提高Linux技能,6个必读的RFC等
  8. 字符串char与string转换
  9. js操作select(添加、移除、获取select值)
  10. 崩了导致代码都乱了_抖音崩了?别慌,你的快乐还在
  11. 【Hoxton.SR1版本】Spring Cloud Eureka服务注册中心单节点搭建
  12. 如何写PRD (附PRD案例)
  13. 教你阅读vue源码的正确姿势,看完就学废!
  14. 关于虚拟机xp系统上不了网的问题
  15. c语言流水灯循环左移程序,51单片机流水灯左移 右移控制程序
  16. 一起学libcef--搭建自己的libcef运行环境(Win32程序,错误C2220解决方案)
  17. 【T3】批次参照结存数量为0的也显示
  18. vscode ssh连接服务器报错:过程试图写入的管道不存在
  19. Discuz 批量修改、替换帖子标题或内容
  20. 两个同品牌路由器有线连接

热门文章

  1. Microduino中LM75温度传感器的使用
  2. 【算法学习】AVL平衡二叉搜索树原理及各项操作编程实现(C++)
  3. 课程目标IO java
  4. 用按钮控制歌单的上一曲和下一曲 0130 winform
  5. django 路由分发 url分层
  6. laravel-admin 在列表页添加自定义按钮
  7. 通过fiddler和逍遥模拟器模拟抓包android手机
  8. Socket编程:之TCP案例
  9. Windows多线程多任务设计初步zz
  10. Docker存储空间不够,如何Docker修改存储位置以进行扩容