简体   繁体   English

如何使用核心Python包在Google App Engine中部署Flask应用程序?

[英]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

My suggestion. 我的建议。

1.Create application in Google admin console google admin console 1.在Google管理控制台中创建应用程序Google 管理控制台

  1. Put app.yaml inside your project root directory 将app.yaml放在项目根目录中

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 
  1. Make folder ( lib ) inside the root directory put all the dependencies inside the folder 将根目录下的Make文件夹( lib )放到该文件夹​​内

  2. 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')

  1. Run the app localy using this command - dev_appserver.py . 使用此命令-dev_appserver.py运行本地应用程序。

  2. 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.

相关问题 如何在Google App Engine上部署我的Flask应用程序? - how to deploy my flask application on google app engine? 如何使用应用工厂将 Flask 应用部署到 Google Cloud(App Engine),以及如何编写 app.yaml 文件? - How to deploy a Flask app to Google Cloud (App Engine) with an application factory, and how to write the app.yaml file? 如何使用Python在Google App Engine中使用应用程序部署映像 - How to Deploy an Image with the Application in Google App Engine Using Python 无法在 Google App Engine 中使用 PostgreSQL 部署 Flask-Python 应用程序 - Unable to Deploy Flask-Python App with PostgreSQL in Google App Engine 如何在Google App Engine中部署应用程序 - How to deploy application in google app engine 如何在Google App Engine中部署Django应用程序? - How to deploy Django application in Google App Engine? 在 Google App Engine 上部署 Flask 和 Tensorflow 服务 - Deploy Flask and Tensorflow serving on Google App Engine Python部署到Google App Engine - Python deploy to Google App Engine 使用谷歌应用引擎部署基于控制台的 python 应用程序 - Deploy console based python application using google app engine 如何将 Flask 应用程序作为包部署到 App Engine? - How to deploy Flask app as package to App Engine?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM