File: webapp.py

package info (click to toggle)
pyamf 0.6.1%2Bdfsg-3
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 7,692 kB
  • sloc: python: 17,944; xml: 455; makefile: 116; sql: 38; java: 11; sh: 7
file content (35 lines) | stat: -rw-r--r-- 772 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import logging

from google.appengine.ext import webapp
from google.appengine.ext.webapp.util import run_wsgi_app

from pyamf.remoting.gateway.google import WebAppGateway


class MainPage(webapp.RequestHandler):
    def get(self):
        self.response.headers['Content-Type'] = 'text/plain'
        self.response.out.write('Hello, webapp World!')


def echo(data):
    return data


def main():
    debug_enabled = True

    services = {
        'myservice.echo': echo,
    }

    gateway = WebAppGateway(services, logger=logging, debug=debug_enabled)

    application_paths = [('/', gateway), ('/helloworld', MainPage)]
    application = webapp.WSGIApplication(application_paths, debug=debug_enabled)

    run_wsgi_app(application)


if __name__ == '__main__':
  main()