Search code examples
pythongoogle-app-engineherokuwebapp2

How to run webapp2(appengine) in Heroku?


Here is my project file

Procfile

web: python main.py

requirement.txt

webapp2==2.3

main.py

import webapp2

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


app = webapp2.WSGIApplication([
    ('/', MainHandler)
], debug=True)

still heroku give out a Application Error

what's wrong with my project?


Solution

  • Base on their getting started with python it seems like you need gunicorn web server. Try adding gunicorn in your requirements.txt and procfile web: gunicorn main:app

    Forgot to add the link: https://devcenter.heroku.com/articles/python

    Also here is my webapp2-starter, it's setup to act like an appengine dev server but works outside app engine. https://github.com/faisalraja/webapp2-starter