0

I've got an aiohttp based project in Python, not overly complicated, just takes advantage of the async routes, etc. I'd like to quickly deploy to Heroku and cannot find a recent step by step. I've tried using their standard Gunicorn approach and it's not working. My Procfile is:

web: gunicorn go:web --preload

Here are the errors that seem to be important from my Heroku log:

2020-06-28T01:37:40.103872+00:00 app[web.1]: ======== Running on http://0.0.0.0:8080 ========
2020-06-28T01:37:40.103895+00:00 app[web.1]: (Press CTRL+C to quit)
2020-06-28T01:37:51.000000+00:00 app[api]: Build succeeded
2020-06-28T01:38:31.441039+00:00 heroku[web.1]: Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launch

If anyone has successfully deployed an aiohttp project to Heroku, I'd love to know what you had to adjust to get it working! Thanks very much.

Stacey Reiman
  • 666
  • 4
  • 13

1 Answers1

0

I got this working for a hello world aiohttp app

here's app.py

from aiohttp import web
import os


async def hello(request):
    return web.Response(text="Hello, world")


app = web.Application()
app.add_routes([web.get('/', hello)])


web.run_app(app, port=os.getenv('PORT'))

Procfile web: python app.py --bind localhost:8080

requirements.txt

aiohttp
Flask
Werkzeug

Thankful for this other SO post which help alot for not using gunicorn.

BAMN!

enter image description here

bbartling
  • 3,288
  • 9
  • 43
  • 88