Thursday, April 12, 2012

在App Engine上使用bottle框架

application: my-bottle-app\
version: 1
runtime: python
api_version: 1

handlers:
- url: /styles
static_dir: styles

- url: /.*
script: main.py

from framework import bottle
from framework.bottle import route, template, request, error, debug
from google.appengine.ext.webapp.util import run_wsgi_app

@route('/')
def DisplayForm():
message = 'Hello World'
output = template('templates/home', data = message)
return output

def main():
debug(True)
run_wsgi_app(bottle.default_app())

@error(403)
def Error403(code):
return 'Get your codes right dude, you caused some error!'

@error(404)
def Error404(code):
return 'Stop cowboy, what are you trying to find?'

if __name__=="__main__":
main()

2 comments:

  1. 最近空间快到期,也想换个空间,请问博主这个wordpress的博客主机空间,包年多少,在国内速度如何、

    ReplyDelete