nazolabo

フリーランスのWebエンジニアが近況や思ったことを発信しています。

GAE/GOでデプロイする(二段階認証編)

チュートリアル通りにやったらできねーよ!的なやつ

% ~/go_appengine/goapp deploy
09:38 AM Application: helloworld; version: 1
09:38 AM Host: appengine.google.com
09:38 AM
Starting update of app: helloworld, version: 1
09:38 AM Getting current resource limits.
Email: (メールアドレス)
Password for (メールアドレス):
Use an application-specific password instead of your regular account password.
See http://www.google.com/support/accounts/bin/answer.py?answer=185833
However, now the recommended way to log in is using OAuth2. See
https://developers.google.com/appengine/docs/go/tools/uploadinganapp#Go_Password-less_login_with_OAuth2

書いてある通りに対応する

% ~/go_appengine/appcfg.py --oauth2 update .
09:38 AM Application: helloworld; version: 1
09:38 AM Host: appengine.google.com
09:38 AM
Starting update of app: helloworld, version: 1
09:38 AM Getting current resource limits.
Your browser has been opened to visit:

    https://accounts.google.com/o/oauth2/auth(略)

If your browser is on a different machine then exit and re-run this
application with the command-line parameter

  --noauth_local_webserver

Authentication successful.
2014-10-15 09:38:51,495 ERROR appcfg.py:2416 An error occurred processing file '': HTTP Error 403: Forbidden Unexpected HTTP status 403. Aborting.
Error 403: --- begin server output ---
You do not have permission to modify this app (app_id=u'helloworld').
--- end server output —

よーしこれで動くかな

% ~/go_appengine/goapp deploy
09:38 AM Application: helloworld; version: 1
09:38 AM Host: appengine.google.com
09:38 AM
Starting update of app: helloworld, version: 1
09:38 AM Getting current resource limits.
Email:

ファッ
どうやら-oauthとか付ける必要があるらしい(どっかで見た)

% ~/go_appengine/goapp deploy -oauth
09:40 AM Application: helloworld; version: 1
09:40 AM Host: appengine.google.com
09:40 AM
Starting update of app: helloworld, version: 1
09:40 AM Getting current resource limits.
2014-10-15 09:40:41,340 ERROR appcfg.py:2416 An error occurred processing file '': HTTP Error 403: Forbidden Unexpected HTTP status 403. Aborting.
Error 403: --- begin server output ---
You do not have permission to modify this app (app_id=u'helloworld').
--- end server output ---
error while running appcfg.py: exit status 1

アプリ作ってねーじゃん!
ここから作って、app.yamlのapplication:を、作ったプロジェクトのProject IDにする。

% ~/go_appengine/goapp deploy -oauth
09:49 AM Application: (Project ID); version: 1
09:49 AM Host: appengine.google.com
09:49 AM
Starting update of app: (Project ID), version: 1
09:49 AM Getting current resource limits.
09:49 AM Scanning files on local disk.
09:49 AM Cloning 2 application files.
09:49 AM Uploading 1 files and blobs.
09:49 AM Uploaded 1 files and blobs
09:49 AM Compilation starting.
09:49 AM Compilation: 1 files left.
09:49 AM Compilation completed.
09:49 AM Starting deployment.
09:49 AM Checking if deployment succeeded.
09:49 AM Deployment successful.
09:49 AM Checking if updated app version is serving.
09:49 AM Completed update of app: (Project ID), version: 1

デプロイできた
http://[Project ID].appspot.com/ で表示できる。