I'm trying to get web.py app running on local Google App Engine.

My yaml:

application: appname
version: 1
runtime: python27
api_version: 1
threadsafe: true

handlers:
- url: /.*
  script: code.app

My code.py:

import web

urls = (
    "/.*", "hello",
)

app = web.application(urls, globals())

class hello:
    def GET(self):
        return 'Hello, world!'

app = app.gaerun()

When I start the server all I get is a blank page. So what's wrong?

Edit:

python --version
Python 2.7.6

Edit 2:

Error from console:

ImportError: No module named web
有帮助吗?

解决方案

What you're trying to do is import an external module, which is not supported by GAE.

What you can do though, is copy web.py into your app directory, and then use it. See "How to include third party Python libraries in Google App Engine".

You can get the source code from here

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top