Skip to content Skip to sidebar Skip to footer

Problems Deploying Bottle Application With Google App Engine

newbie here--I've been trying to create a 'Hello World' in bottle using google app engine. I got the 'hello world' part to show up, but even on on index page, I get the following o

Solution 1:

Here's a good tutorial for bottle on GAE: http://blog.rutwick.com/use-bottle-python-framework-with-google-app-engine

DISCLAIMER: I did not run the tutorial, but it looks correct.

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('/')defDisplayForm():
    message = 'Hello World'
    output = template('templates/home', data = message)
    return output

defmain():
    debug(True)
    run_wsgi_app(bottle.default_app())

@error(403)defError403(code):
    return'Get your codes right dude, you caused some error!'@error(404)defError404(code):
    return'Stop cowboy, what are you trying to find?'if __name__=="__main__":
    main()

app.yaml:

application:my-bottle-appversion:1runtime:pythonapi_version:1handlers:-url:/stylesstatic_dir:styles-url:/.*script:main.py

As you see there, are a number of differences from your sample code. The tutorial does a good job of explaining them, so I won't go into detail here.

Solution 2:

This might help:

app.yaml:

application:my-appversion:1runtime:python27api_version:1threadsafe:yes-url:.*script:main.app

main.py:

import bottle

@bottle.route('/')defroot():
    return'hello!'

bottle.run(server='gae', debug=True)
app = bottle.app()

Here's the original answer from GitHub. https://github.com/defnull/bottle/issues/401

Solution 3:

When using WSGI like in the App Engine + Bottle started code, you can call bottle.debug() when your code is running on the dev server:

import bottle
importosDEBUG= os.environ.get('SERVER_SOFTWARE','').startswith('Development')  
bottle.debug(DEBUG)
app = bottle.Bottle()

And in app.yaml:

handlers:-url:.*script:main.app

Post a Comment for "Problems Deploying Bottle Application With Google App Engine"