Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Google App Engine入門
Search
Satoshi Miura
February 01, 2015
Programming
660
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Google App Engine入門
Python東海26回勉強会での発表資料です
Satoshi Miura
February 01, 2015
More Decks by Satoshi Miura
See All by Satoshi Miura
MarkdownでもSphinx
mursts
1
460
お金ダッシュボードを作ってみた
mursts
0
340
asyncioを軽くさわってみた
mursts
0
180
FlaskとYomanでHello World
mursts
0
400
Other Decks in Programming
See All in Programming
The ROI of Quarkus for Spring Boot Applications
hollycummins
0
110
Lemonade + Foundry Toolkit でお手軽アプリ開発
seosoft
1
320
DynamoDBには集計系のクエリがないけどなんとかしたい
musan
1
130
作って学ぶ、 JSX (TSX) ランタイムの基本
syumai
7
1.6k
スマートグラスで並列バイブコーディング
hyshu
0
130
RTSPクライアントを自作してみた話
simotin13
0
580
net-httpのHTTP/2対応について
naruse
0
470
例外の正しい扱い方 そのエラー try-catchして大丈夫?
jinwatanabe
0
210
OSもどきOS
arkw
0
540
Agentic UI
manfredsteyer
PRO
0
150
Contextとはなにか
chiroruxx
1
300
Oxcを導入して開発体験が向上した話
yug1224
4
310
Featured
See All Featured
Pawsitive SEO: Lessons from My Dog (and Many Mistakes) on Thriving as a Consultant in the Age of AI
davidcarrasco
0
160
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
35
2.5k
Building a Modern Day E-commerce SEO Strategy
aleyda
45
9.1k
Collaborative Software Design: How to facilitate domain modelling decisions
baasie
1
250
Making Projects Easy
brettharned
120
6.7k
Agile Actions for Facilitating Distributed Teams - ADO2019
mkilby
0
200
GitHub's CSS Performance
jonrohan
1033
470k
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
52
6k
Bash Introduction
62gerente
615
220k
How to train your dragon (web standard)
notwaldorf
97
6.7k
sira's awesome portfolio website redesign presentation
elsirapls
0
280
30 Presentation Tips
portentint
PRO
1
320
Transcript
Google&App&Engineೖ&+&α 2015.01.31'Python౦ւ'26th
͓લͩΕΑ • Έ͏Β͞ͱ͠(@mursts) • PythonɺAndroid͕͖Ͱ͢ • ࣄJavaɺdosbatch • PythonझຯͰ͢
App#EngineΛ͍ͬͯ·͔͢ʁ ͬͨ͜ͱ͋Γ·͔͢ʁ
App#Engineͱ Googleͷఏڙ͢ΔαʔϏεͷ1ͭͰ͋ΓɺΣϒΞϓϦέʔγϣ ϯΛPythonJavaGoݴޠΛ༻ͯ͠։ൃ͠ɺGoogleͷΠϯϑϥ ετϥΫνϟʔ্Ͱ࣮ߦ͠ɺόʔδϣϯཧ͢Δ͜ͱ͕Ͱ͖Δɻ —"Wikipedia"ʮGoogle"App"Engineʯ PythonɺGoɺJavaɺPHP͕ಈ͖·͢
ࠓApp#EngineͱPythonͰ Hello%WorldΛΓ·͢
App#EngineͷڥΛ࡞Δ
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ΛΠϯε τʔϧ͠·͢
webapp2Λ༻ͨ͠ϓϩδΣΫτͷςϯϓϨʔτ͕ҎԼʹ༻ҙ͞Ε͍ͯ·͢ ~/google'cloud'sdk/pla/orm/googleappengine/ new_project_template_ ├── app.yaml ├── favicon.ico ├── index.yaml └──
main.py ※ڥʹΑΓͰύε͕ҧ͏߹͕͋ΔΑͰ͢
main.py import webapp2 class MainHandler(webapp2.RequestHandler): def get(self): self.response.write('Hello world!') app
= webapp2.WSGIApplication([ ('/', MainHandler) ], debug=True)
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"
GitHubʹଞͷϑϨʔϜϫʔΫͷςϯϓϨʔτ͋Γ·͢ • Django • flask • bo,le
͜ΜͳγΣϧΛ࡞ͬͯϓϩδΣΫτΛ࡞͍ͬͯ·͢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}"
͜ΜͳγΣϧΛ࡞ͬͯϓϩδΣΫτΛ࡞͍ͬͯ·͢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
ϩʔΧϧͰಈ͔ͯ͠ΈΔ copy template or git clone $ dev_appserver.py ./ >
http://localhost:8080
σϓϩΠ ϓϩδΣΫτΛ࡞ h"ps:/ /console.developers.google.com/ project?hl=ja
σϓϩΠ app.yamlͷΞϓϦέʔγϣϯ໊Λ࡞ͨ͠ϓϩδΣΫτ໊ʹมߋ diff app.yaml.org app.yaml 1c1 < application: new-project-template ---
> application: pythontokai26
σϓϩΠ $ appcfg.py update ./ >!h#p:/ /project(id.appspot.com project-id:"Developers"ConsoleͰ࡞ ͨ͠ID
ؒʹ߹͑͏ͻͱͭ +αͰManagedVMͷΛ͠Α͏ͱࢥ͍·ͨ͠ ͕ؒʹ߹͍·ͤΜͰͨ͠ ࣍ճͷษڧձͰΓ͍ͨͱࢥ͍·͢
͋Γ͕ͱ͏͍͟͝·ͨ͠