Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Google App Engine入門

Google App Engine入門

Python東海26回勉強会での発表資料です

Satoshi Miura

February 01, 2015
Tweet

More Decks by Satoshi Miura

Other Decks in Programming

Transcript

  1. SDKͷΠϯετʔϧ h"ps:/ /cloud.google.com/sdk/ $ curl https://sdk.cloud.google.com | bash # for

    Linux / OS X $ gcloud auth login $ gcloud components update ※!Windows͸Πϯετʔϥ͕༻ҙ͞Ε͍ͯ·͢ App#Engine͚ͩͷSDK΋͋Γ·͕͢ɺ͜͜Ͱ͸Cloud#SDKΛΠϯε τʔϧ͠·͢
  2. app.yaml application: new-project-template version: 1 runtime: python27 api_version: 1 threadsafe:

    yes handlers: - url: /favicon\.ico static_files: favicon.ico upload: favicon\.ico - url: .* script: main.app libraries: - name: webapp2 version: "2.5.2"
  3. ͜ΜͳγΣϧΛ࡞ͬͯϓϩδΣΫτΛ࡞͍ͬͯ·͢1 create&gae&project@gist #!/bin/sh PROJECT_TEMPLATE_PATH=${HOME}/google-cloud-sdk/platform/google_appengine/new_project_template if [ $# -eq 0 ];

    then CMD=`basename $0` echo "usage: ${CMD} projectname" exit 1 fi PROJECT_NAME=$1 cp -R $PROJECT_TEMPLATE_PATH $PROJECT_NAME cd $PROJECT_NAME sed -i '' "s/new-project-template/${PROJECT_NAME}/g" app.yaml echo "New Google App Engine Project Created." echo " ${PROJECT_NAME}"
  4. ͜ΜͳγΣϧΛ࡞ͬͯϓϩδΣΫτΛ࡞͍ͬͯ·͢2 create&gae&project&flask@gist #!/bin/sh if [ $# -eq 0 ]; then

    CMD=`basename $0` echo "usage: ${CMD} projectname" exit 1 fi PROJECT_NAME=$1 if [ -d ${PROJECT_NAME} ] ; then echo "${PROJECT_NAME} is exists" exit 1 fi git clone https://github.com/GoogleCloudPlatform/appengine-python-flask-skeleton.git "${PROJECT_NAME}" cd "${PROJECT_NAME}" #git remote rm origin rm -rf .git pip install -r requirements.txt -t lib sed -i '' "s/your-application-id-here/${PROJECT_NAME}/g" app.yaml exit 0