Google App Engine for Pythonã®éçºç°å¢ãUbuntu 10.04ã«æ§ç¯ãã
Google App Engineã®Pythonçã®éçºç°å¢ãUbuntu 10.04ã«æ§ç¯ããéã®æé ãã¡ã¢ãã¦ããã¾ãã
ã¤ãã§ã«ãHello WorldãGAEã«ãããã¤ããã¾ã§ã®æé ãè¼ãã¦ããã¾ããã
Python 2.5ã®ã¤ã³ã¹ãã¼ã«
Pythonã®ãã¼ã¸ã§ã³ã¯2.5ã§ããUbuntuã®æè¿ã®ãã¼ã¸ã§ã³ã®ããã©ã«ãã¯2.6ãªã®ã§ã
Python 2.5ã以ä¸ã®æé ã§ã¤ã³ã¹ãã¼ã«ãã¾ãã
ã¾ããSynapticã®ãªãã¸ããªã追å ãã¾ãã
以ä¸ã®2è¡ã/etc/apt/sources.listã«è¿½å ããããSynapticããã±ã¼ã¸ããã¼ã¸ã£ã§è¿½å ãã¦ãã ããã
$ sudo vi /etc/apt/sources.list
deb http://ppa.launchpad.net/fkrull/deadsnakes/ubuntu lucid main deb-src http://ppa.launchpad.net/fkrull/deadsnakes/ubuntu lucid main
apt-getã§Python2.5ãã¤ã³ã¹ãã¼ã«ãã¾ãã
$ sudo apt-get update $ sudo apt-get install python2.5
10.04ã§ã¯ãapt-getã§ã¤ã³ã¹ãã¼ã«ããå ´åã¯ãããã©ã«ãã®pythonã¯2.6ã®ã¾ã¾ä¸æ¸ãããããã¨ã¯ããã¾ããã§ããã®ã§ããã¨ã®ç°å¢ã«å½±é¿ã¯ãªãããã§ãã
åè: http://www.codigomanso.com/en/2010/05/google-app-engine-en-ubuntu-10-4-lucid-lynx/
ã¾ããapt-getã§ã¤ã³ã¹ãã¼ã«ããå ´åãSSLã®è¨å®ãå«ã¾ãã¦ãã¾ãããã¢ããªã±ã¼ã·ã§ã³ãã¢ãããã¼ãããéã«SSLéä¿¡ãå¿
è¦ãªå ´åã¯ã以ä¸ã®ãµã¤ãã®æé ã«ãããã£ã¦Pythonãã³ã³ãã¤ã«ãã¦ã¤ã³ã¹ãã¼ã«ããå¿
è¦ãããããã§ãã
http://thedarren.blogspot.com/2010/11/install-appengine-python-sdk-on-ubuntu.html
Google App Engine SDKã®ã¤ã³ã¹ãã¼ã«
次ã«Google App Engine SDKãã¤ã³ã¹ãã¼ã«ãã¾ãã
Google App Engine SDK for Pythonã以ä¸ã®ãã¦ã³ãã¼ããµã¤ããããã¦ã³ãã¼ããã¾ãã
http://code.google.com/intl/ja/appengine/downloads.html#Download_the_Google_App_Engine_SDK
Linuxç¨ã®SDKã¯google_appengine_1.3.8.zip(2010å¹´11æ28æ¥ç¾å¨)ã§ãã
ãã¦ã³ãã¼ãå¾ã解åãã¦ã解åãããã£ã¬ã¯ããªã«ç§»åãã¦ããã¾ãã
$ wget http://googleappengine.googlecode.com/files/google_appengine_1.3.8.zip $ unzip google_appengine_1.3.8.zip $ cd google_appengine
次ã«ããã¼ã«ã«ã§HelloãWorldãå®è¡ãã¦ããããGAEã«ãããã¤ããã¨ããã¾ã§ã説æãã¾ãã
ãã®è¾ºã¯Googleã®ããã¥ã¡ã³ãã«ã詳ãã説æãå¨ãã®ã§ããããããã«æ¸ãå¿
è¦ãç¡ãã®ã§ããããã£ãããªã®ã§ä¸éãã³ãã³ããã¡ã¢ãã¦ããã¾ãã
ãã¼ã«ã«ã§HelloWorld
helloworldç¨ã®ãã£ã¬ã¯ããªãä½ãã¾ãã
$ mkdir helloworld $cd helloworld
ãªã¯ã¨ã¹ããå®è¡ãããã¡ã¤ã«ãä½æãã¾ãã
$ vi helloworld.py print 'Content-Type: text/plain' print '' print 'Hello, world!'
ã¢ããªã±ã¼ã·ã§ã³ã®è¨å®ãã¡ã¤ã«ãä½æãã¾ãã
$ vi app.yaml application: helloworld version: 1 runtime: python api_version: 1 handlers: - url: /.* script: helloworld.py
å ã»ã©è§£åããgoogle_appsengineãã£ã¬ã¯ããªã«æ»ã£ã¦ããµã¼ãã¼ãèµ·åãã¾ãã
$ .. $ python2.5 ./dev_appserver.py helloworld/ hrendoh@hrendoh-laptop:~/google_appengine$ python2.5 dev_appserver.py helloworld/ INFO 2010-11-28 03:24:51,195 appengine_rpc.py:153] Server: appengine.google.com Allow dev_appserver to check for updates on startup? (Y/n): (Yãé¸æãã¾ãã) dev_appserver will check for updates on startup. To change this setting, edit /home/hrendoh/.appcfg_nag INFO 2010-11-28 03:26:11,871 appcfg.py:414] Checking for updates to the SDK. INFO 2010-11-28 03:26:12,966 appcfg.py:428] The SDK is up to date. WARNING 2010-11-28 03:26:12,966 datastore_file_stub.py:818] Could not read datastore data from /tmp/dev_appserver.datastore WARNING 2010-11-28 03:26:12,975 dev_appserver.py:3663] Could not initialize images API; you are likely missing the Python "PIL" module. ImportError: No module named _imaging INFO 2010-11-28 03:26:12,983 dev_appserver_main.py:443] Running application helloworld on port 8080: http://localhost:8080
ãã©ã¦ã¶ã§localhost:8080ã«ã¢ã¯ã»ã¹ãã¦ãHello World!ãã¨è¡¨ç¤ºãããã°èµ·åæåã§ãã
ãã®å
容ã¯ã以ä¸ã®Googleã®å
¬å¼ããã¥ã¡ã³ãã«è¨è¼ããã¦ãã¾ãã
http://code.google.com/intl/ja/appengine/docs/python/gettingstarted/helloworld.html
GAEã«ãããã¤ãã
http://appengine.google.com/ã«ã¢ã¯ã»ã¹ãã¦ããããã¤ç¨ã®ã¢ããªã±ã¼ã·ã§ã³ãç¨æãã¾ãã
ã¾ãã[Create an Application] ãã¿ã³ãã¯ãªãã¯ãã¾ãã
ã¢ããªã±ã¼ã·ã§ã³IDãæå®ãã¦[Create Application]ãã¿ã³ãã¯ãªãã¯ãã¾ãã
ããã§ã¯ãã¢ããªã±ã¼ã·ã§ã³IDã"helloworld-hrendoh"ã«ãã¾ããã
以ä¸ã®ãã¼ã¸ã表示ãããã°ç»é²çµäºã§ãã
ç»é²ããã¢ããªã±ã¼ã·ã§ã³IDãapp.yamlã®applicationã«æå®ãã¾ããã«æå®ãã¾ãã
$ cd helloworld $ vi app.yaml
application: helloworld-hrendoh version: 1 runtime: python api_version: 1 handlers: - url: /.* script: helloworld.py
å度ã解åããgoogle_appsengineãã£ã¬ã¯ããªã«æ»ã£ã¦ãã¢ãããã¼ãã®ã³ãã³ããå®è¡ãã¾ãã
$ cd .. $ python2.5 ./appcfg.py update helloworld/ Application: helloworld-hrendoh; version: 1. Server: appengine.google.com. Scanning files on local disk. Initiating update. 2010-11-28 12:54:21,024 WARNING appengine_rpc.py:405 ssl module not found. Without the ssl module, the identity of the remote host cannot be verified, and connections may NOT be secure. To fix this, please install the ssl module from http://pypi.python.org/pypi/ssl . To learn more, see http://code.google.com/appengine/kb/general.html#rpcssl . Email: hrendoh@gmail.com Password for hrendoh@gmail.com: xxxx Cloning 2 application files. Uploading 1 files and blobs. Uploaded 1 files and blobs Precompilation starting. Precompilation completed. Deploying new version. Checking if new version is ready to serve. Will check again in 1 seconds. Checking if new version is ready to serve. Will check again in 2 seconds. Checking if new version is ready to serve. Closing update: new version is ready to start serving.
ãã®å
容ã¯ã以ä¸ã®Googleã®å
¬å¼ããã¥ã¡ã³ãã«è¨è¼ããã¦ãã¾ãã
http://code.google.com/intl/ja/appengine/docs/python/gettingstarted/uploading.html
SSLã®ã¨ã©ã¼ã«ã¤ãã¦
ãpython2.5ã®ã¤ã³ã¹ãã¼ã«ãã®ã¨ããã§ãæ¸ãã¾ããããapt-getã§ã¤ã³ã¹ãã¼ã«ããã¨ãSSLãµãã¼ããªãã®Pythonãã¤ã³ã¹ãã¼ã«ããã¦ãã¾ãã¾ãã
以ä¸ã®Google codeã®ã¨ã³ããªã«ãããã¾ãããå®éã«ã¯PythonãSSLä»ãã§ã³ã³ãã¤ã«ãã¦ã¤ã³ã¹ãã¼ã«ããå¿
è¦ãããã¾ãã
http://code.google.com/p/googleappengine/issues/detail?id=757#c51
Python2.5ãã³ã³ãã¤ã«ãã¦ã¤ã³ã¹ãã¼ã«ããæ¹æ³ã¯ä»¥ä¸ã®ãµã¤ããè¯ãã¾ã¨ã¾ã£ã¦ããã®ã§åèã«ãã¦ã¿ã¦ãã ããã
http://thedarren.blogspot.com/2010/11/install-appengine-python-sdk-on-ubuntu.html
ã¾ããæ¨æºã§ã¤ã³ã¹ãã¼ã«ããã¦ãã2.6ã¯SSLãµãã¼ããããPythonãã¤ã³ã¹ãã¼ã«ããã¦ãã¾ããappcfg.pyã¯Python2.6ã§ãåé¡ãªãå®è¡ã§ããã®ã§ãå®éã«ã¯èªåã¯ã¢ãããã¼ãããã¨ãã®ã¿2.6ã使ãããã«ãã¦ãã¾ãã