如何在Heroku中运行webapp2(appengine)?

Alv*_*var 3 python google-app-engine heroku webapp2

这是我的项目文件

Procfile

web: python main.py
Run Code Online (Sandbox Code Playgroud)

requirement.txt

webapp2==2.3
Run Code Online (Sandbox Code Playgroud)

main.py

import webapp2

class MainHandler(webapp2.RequestHandler):
    def get(self):
        self.response.write("hello")


app = webapp2.WSGIApplication([
    ('/', MainHandler)
], debug=True)
Run Code Online (Sandbox Code Playgroud)

仍然heroku发出应用程序错误

我的项目有什么问题?

Fai*_*sal 5

基于他们开始使用python,你似乎需要gunicorn web服务器.尝试在你的requirements.txt和procfile web中添加gunicorn:gunicorn main:app

忘了添加链接:https: //devcenter.heroku.com/articles/python

这里也是我的webapp2-starter,它的设置就像一个appengine开发服务器,但在app引擎外工作. https://github.com/faisalraja/webapp2-starter