我试图在Google中使用CherryPY框架运行一个web应用程序。我无法在本地(从下载的SDK )开发服务器中运行基本helloworld代码。
我要去接ImportError: No module named cherrypy。虽然我确实使用pip安装安装cherrypy,但是相同的代码使用
python hello.py (删除google导入)
这是我的hello.py
import random
import string
import cherrypy
from google.appengine.ext.webapp.util import run_wsgi_app
class StringGenerator(object):
@cherrypy.expose
def index(self):
return "Hello world!"
@cherrypy.expose
def generate(self):
return ''.join(random.sample(string.hexdigits, 8))
if __name__ == '__main__':
cherrypy.quickstart(StringGenerator(), '/')和我的app.yaml文件
version: 1
runtime: python27
api_version: 1
threadsafe: true
# [START handlers]
handlers:
- url: /.*
script: hello.app
# [END handlers]
# [START libraries]
libraries:
- name: webapp2
version: latest
- name: jinja2
version: latest
# [END libraries]发布于 2015-07-12 02:20:12
发布于 2020-07-24 03:07:18
如果您正在使用Python和3+,您可以按照这教程在Google上部署web应用程序/ API。我希望这能帮到你。
https://stackoverflow.com/questions/31360267
复制相似问题