2011年7月1日金曜日

09.Registering the service

ここまでの説明でサービス、メッセージを定義できましたので、
App Engineのwebappフレームワークを利用して、サービスを公開し、
外部からサービスにアクセスできるようにします。

service.pyというファイルをアプリケーションディレクトリに作成してください。
そして、以下のコードを追加します。

from google.appengine.ext import webapp
from google.appengine.ext.webapp import util
from protorpc.webapp import service_handlers
import postservice
# Register mapping with application.
application = webapp.WSGIApplication(
  service_handlers.service_mapping(
      [('/postservice', postservice.PostService)]),
  debug=True)

def main():
  util.run_wsgi_app(application)

if __name__ == '__main__':
  main()


そして、以下のURLハンドラをapp.yamlに追加してください。

- url: /postservice.*
  script: services.py

0 件のコメント:

コメントを投稿