【问题标题】:python Google App engine deploymentpython Google App引擎部署
【发布时间】:2015-08-11 23:59:39
【问题描述】:

我是谷歌应用引擎的新手。我在 python 中创建了一个 hello world 应用程序并在本地对其进行了验证。我尝试使用以下命令进行部署

appcfg.py -A 项目 ID 更新目录\

它会打开一个浏览器并要求我登录到我的谷歌应用程序帐户。一旦我这样做了,浏览器就会显示一个带有本地主机的 url。该应用程序再次在本地主机上运行,​​并且没有部署在谷歌云上。我尝试使用项目 ID 访问 url,即http://your-app-id.appspot.com/,但它说找不到错误。有谁遇到过这个问题,可以帮忙吗?

【问题讨论】:

    标签: google-app-engine


    【解决方案1】:

    这种行为有几个可能的原因:

    • 您没有正确使用 appcfg.py 命令
    • 您使用的 glcoud 版本不支持 appcfg.py 进行 GAE 部署(该命令正在“滚动到”gcloud 工具集中)

    要检查您安装的 gcloud 版本,只需运行 $ gcloud

    较新的 gcloud 使用以下语法:$ gcloud preview app deploy ~/my_app/app.yaml 这是 link 以及有关 deployment 的更多详细信息

    【讨论】:

      【解决方案2】:

      此部署适用于 windows 平台 1) 谷歌应用引擎上的本地服务器部署:

      cd to C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\bin
      then run command
      
      python dev_appserver.py  C:\000_hello_endpoints(location)
      
      this will deploy your app locally on http://localhost:8080
      
       Output :
      INFO 2017-05-25 13:51:20,782 devappserver2.py:692] Skipping SDK update check.
      INFO 2017-05-25 13:51:22,221 api_server.py:272] Starting API server at: http://localhost:21018
      INFO 2017-05-25 13:51:22,232 dispatcher.py:205] Starting module "default" running at: localhost:8080
      INFO 2017-05-25 13:51:22,232 admin_server.py:116] Starting admin server at: http://localhost:8000
      
      2) Cloud app Deployment on Google app engine:
      
      Run gcloud init command in google cloud sdk shell:
      Choose the account you would like to use to perform operations for
      this configuration:
       [1] karanchaparwalops@gmail.com
       [2] Log in with a new account
      Please enter your numeric choice: 1
      
      You are logged in as: [karanchaparwalops@gmail.com].
      
      Pick cloud project to use:
       [1] machine-nebula-168
       [2] Create a new project
      Please enter numeric choice or text value (must exactly match list
      item): 1
      
      Your current project has been set to: [machine-nebula-168].
      
      Do you want to configure Google Compute Engine
      (cloud.google.com/compute) settings (Y/n)? Y
      
      Which Google Compute Engine zone would you like to use as project
      default?
      If you do not specify a zone via a command line flag while working
      with Compute Engine resources, the default is assumed.
       [1] asia-east1-b
       [2] asia-east1-a
       [3] asia-east1-c
       [4] asia-northeast1-c
       [5] asia-northeast1-a
       [6] asia-northeast1-b
       [7] asia-southeast1-b
       [8] asia-southeast1-a
       [9] europe-west1-d
       [10] europe-west1-c
       [11] europe-west1-b
       [12] us-central1-b
       [13] us-central1-f
       [14] us-central1-a
       [15] us-central1-c
       [16] us-east1-d
       [17] us-east1-c
       [18] us-east1-b
       [19] us-east4-b
       [20] us-east4-c
       [21] us-east4-a
       [22] us-west1-b
       [23] us-west1-a
       [24] Do not set default zone
      Please enter numeric choice or text value (must exactly match list
      item): 1
      
      Your project default Compute Engine zone has been set to [asia-east1-b].
      You can change it by running [gcloud config set compute/zone NAME].
      
      Your project default Compute Engine region has been set to [asia-east1].
      You can change it by running [gcloud config set compute/region NAME].
      
      Your Google Cloud SDK is configured and ready to use!
      
      * Commands that require authentication will use karanchaparwalops@gmail.com by default
      * Commands will reference project `machine-nebula-168` by default
      * Compute Engine commands will use region `asia-east1` by default
      * Compute Engine commands will use zone `asia-east1-b` by default
      
      Run `gcloud help config` to learn how to change individual settings
      
      This gcloud configuration is called [default]. You can create additional configurations if you work with multiple accounts and/or projects.
      Run `gcloud topic configurations` to learn more.
      
      Some things to try next:
      
      * Run `gcloud --help` to see the Cloud Platform services you can interact with. And run `gcloud help COMMAND` to get help on any gcloud command.
      * Run `gcloud topic -h` to learn about advanced features of the SDK like arg files and output formatting
      
      C:\000_Hello_Endpoints>gcloud app deploy
      You are creating an app for project [machine-nebula-168].
      WARNING: Creating an App Engine application for a project is irreversible and the region
      cannot be changed. More information about regions is at
      cloud.google.com/appengine/docs/locations.
      
      Please choose the region where you want your App Engine application
      located:
      
       [1] europe-west (supports standard and flexible)
       [2] us-east1 (supports standard and flexible)
       [3] us-central (supports standard and flexible)
       [4] asia-northeast1 (supports standard and flexible)
       [5] us-east4 (supports standard and flexible)
       [6] cancel
      Please enter your numeric choice: 4
      
      Creating App Engine application in project [machine-nebula-168] and region [asia-northeast1]....done.
      You are about to deploy the following services:
       - machine-nebula-168/default/20170525t134403 (from [C:\000_Hello_Endpoints\app.yaml])
        Deploying to URL: [machine-nebula-168.appspot]
      
      Do you want to continue (Y/n)? Y
      
      Beginning deployment of service [default]...
      Some files were skipped. Pass `--verbosity=info` to see which ones.
      You may also view the gcloud log file, found at
      [C:\Users\KaranC\AppData\Roaming\gcloud\logs\2017.05.25\13.43.24.426000.log].
      ╔════════════════════════════════════════════════════════════╗
      ╠═ Uploading 4 files to Google Cloud Storage ═╣
      ╚══════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════╝
      File upload done.
      Updating service [default]...done.
      Deployed service [default] to [machine-nebula-168.appspot]
      
      You can stream logs from the command line by running:
        $ gcloud app logs tail -s default
      
      To view your application in the web browser run:
        $ gcloud app browse
      
      C:\000_Hello_Endpoints>gcloud app browse
      Opening [https://machine-nebula-168.appspot.com] in a new tab in your default browser.
      

      我假设你已经为 windows 安装了 python app engine sdk 感谢您的关注..upvote 如果有帮助

      【讨论】:

        猜你喜欢
        • 2021-06-19
        • 1970-01-01
        • 2015-02-11
        • 2019-10-10
        • 1970-01-01
        • 1970-01-01
        • 2015-02-11
        • 2011-12-05
        • 2014-04-11
        相关资源
        最近更新 更多