<Google Cloud Platform, Flask> Flaskを動かしてみる。

Flaskさんを動かしてみる。
こちらを参考。

qiita.com

Gitして、dev_appserver.pyしてみた。

py27 % git clone https://github.com/GoogleCloudPlatform/appengine-flask-skeleton.git
Cloning into 'appengine-flask-skeleton'...
remote: Counting objects: 520, done.
remote: Total 520 (delta 0), reused 0 (delta 0), pack-reused 520
Receiving objects: 100% (520/520), 1.15 MiB | 333.00 KiB/s, done.
Resolving deltas: 100% (64/64), done.

py27 % cd appengine-flask-skeleton/
app.yaml  appengine_config.py  CONTRIB.md  lib/  LICENSE  main.py  README.md  requirements.txt

py27 % ls lib
flask/                 itsdangerous.py               jinja2/                markupsafe/                 README.md  Werkzeug-0.11.dist-info/
Flask-0.10.dist-info/  itsdangerous-0.24.dist-info/  Jinja2-2.8.dist-info/  MarkupSafe-0.23.dist-info/  werkzeug/

py27 % ~/google-cloud-sdk/bin/dev_appserver.py .
INFO     2016-11-19 11:49:12,184 devappserver2.py:769] Skipping SDK update check.
WARNING  2016-11-19 11:49:12,286 simple_search_stub.py:1146] Could not read search indexes from c:\users\nekoyuki\appdata\local\temp\appengine.None\search_indexes
INFO     2016-11-19 11:49:12,296 api_server.py:205] Starting API server at: http://localhost:55930
INFO     2016-11-19 11:49:12,302 dispatcher.py:197] Starting module "default" running at: http://localhost:8080
INFO     2016-11-19 11:49:12,303 admin_server.py:116] Starting admin server at: http://localhost:8000
INFO     2016-11-19 11:49:49,451 module.py:788] default: "GET / HTTP/1.1" 200 13
INFO     2016-11-19 11:49:50,355 module.py:788] default: "GET /favicon.ico HTTP/1.1" 404 154

localhost:8080Hello World!を確認。
動いたっぽい。なるへそ。

その後、、、
デプロイdeployしてみた。
まずは、こちらで、プロジェクト作成。

https://console.cloud.google.com/home/dashboard

で、
こちらのクイックスタートquickstartに従う。

https://cloud.google.com/appengine/docs/python/quickstart

py27 % ~/google-cloud-sdk/bin/gcloud app deploy --project hagehage-xxxxxx
which: no python2 in (/C/Anaconda3/envs/py27:/C/Anaconda3/envs/py27/Library/mingw-w64/bin:/C/Anaconda3/envs/py27/Library/usr/bin:/C/Anaconda3/envs/py27/Library/bin:/C/Anaconda3/en:/home/Nekoyuki/.zplug/bin:/c/\Program Files (x86)/Google/Chrome/Application:/c/Go/bin:/c/Anaconda3:/c/Anaconda3/Scripts:/usr/local/bin:/usr/bin:/bin:/opt/bin:/c/Windows/System32:/c/Windows:/c/Windows/System32/Wbem:/c/Windows/System32/WindowsPowerShell/v1.0/:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl)
which: no python2.7 in (/C/Anaconda3/envs/py27:/C/Anaconda3/envs/py27/Library/mingw-w64/bin:/C/Anaconda3/envs/py27/Library/usr/bin:/C/Anaconda3/envs/py27/Library/bin:/C/Anaconda3/:/home/Nekoyuki/.zplug/bin:/c/\Program Files (x86)/Google/Chrome/Application:/c/Go/bin:/c/Anaconda3:/c/Anaconda3/Scripts:/usr/local/bin:/usr/bin:/bin:/opt/bin:/c/Windows/System32:/c/Windows:/c/Windows/System32/Wbem:/c/Windows/System32/WindowsPowerShell/v1.0/:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl)
WARNING: Automatic app detection is currently in Beta

You are about to deploy the following services:
 - hagehage-xxxxxx/default/20161119t223810 (from [C:\msys64\home\Nekoyuki\works\works_google_cloud_platform\appengine-flask-skeleton\app.yaml])
     Deployed URL: [https://hagehage-xxxxxx.appspot.com]

Do you want to continue (Y/n)?
Beginning deployment of service [default]...
:
いろいろエラーやらワーニングやら、、、   
:
File upload done.
Updating service [default]...
Updating service [default]...done.
Deployed service [default]

You can read logs from the command line by running:
  $ gcloud app logs read
To view your application in the web browser run:
  $ gcloud app browse

お?いけた?

で、下記にアクセス。

https://hagehage-xxxxxx.appspot.com/

おおー! Hello World!が見れた。

メモ。

Google Cloud関係のgithubは下記らしい。

github.com

github.com

こちらも参考。

blog.kaneshin.co