[英]How to deploy Flask application in google app engine with core python packages?
I want to deploy below python structure in google app engine I want to know how to configure .yaml files for below flask application with core python packages and please suggest a better way to deploy code in google app engine.(I want to deploy all the packages in one location/directory) 我想在Google App Engine中部署以下python结构,我想知道如何使用核心python软件包为以下Flask应用程序配置.yaml文件,并建议一种更好的方法在Google App Engine中部署代码。(我想部署所有软件包放在一个位置/目录中)
Packages: 包装方式:
Model-Engine
- api
- api
- __int__.py
- view.py
- utils.py
- models.py
- tests
- runserver.py
- setup.py
- driver
- driver
- core
- __init__.py
- celery.py
- celery_tasks.py
- tests
- setup.py
Physics
- core
- core
- __init__.py
- base.py
- pipe_line_simulation.py
-tests
- setup.py
Gas-model
- src
- model
- __init__.py
- gas_model.py
- converter
- __init__.py
- hdf5_to_csv.py
- setup.py
1.Create application in Google admin console google admin console 1.在Google管理控制台中创建应用程序Google 管理控制台
sample code: 样例代码:
application: "Application name from google app engine"
version: 1
runtime: python27
api_version: 1
threadsafe: yes
handlers:
- url: /
script: home.app
- url: /index\.html
script: home.app
- url: /stylesheets
static_dir: stylesheets
- url: /(.*\.(gif|png|jpg))$
static_files: static/\1
upload: static/.*\.(gif|png|jpg)$
- url: /admin/.*
script: admin.app
login: admin
Make folder ( lib
) inside the root directory put all the dependencies inside the folder 将根目录下的Make文件夹(
lib
)放到该文件夹内
Create a file appengine_config.py
inside the project directory and put the below codes. 在项目目录中创建一个文件
appengine_config.py
,并输入以下代码。
from google.appengine.ext import vendor
vendor.add('lib')
Run the app localy using this command - dev_appserver.py . 使用此命令-dev_appserver.py运行本地应用程序。
Deploy the application. 部署应用程序。
appcfg.py update -A {your-project-id} -V v1
. appcfg.py update -A {your-project-id} -V v1
。
If this isn't your first deployment, you will need to set the new version as the default version with 如果这不是您的首次部署,则需要使用以下命令将新版本设置为默认版本:
appcfg.py set_default_version -V v1 -A {your-project-id}
Congratulations! 恭喜你! Your application is now live at your-app-id.appspot.com
您的应用程序现在位于your-app-id.appspot.com
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.