1

Im trying to deploy a python app to heroku. I use a web framework called quart (an asyncio adaptation of flask). The build succeeds when I try to deploy, but in the heroku logs, I get this error message:

TypeError: __call__() takes 1 positional argument but 3 were

This is the code that runs the app:

if __name__ == '__main__': 
     app.run(host='0.0.0.0', port=int(os.environ['PORT']))

My procfile consists of this:

web: gunicorn main_loop:app 

Help would be appreciated.

Dup Dup
  • 55
  • 9

1 Answers1

1

Quart requires a specific Gunicorn worker class1. I think if your procfile was

web: gunicorn --worker-class quart.worker.GunicornWorker main_loop:app 

it would work. (I don't have a heroku dyno available to test though).

(I am the Quart author)

Community
  • 1
  • 1
pgjones
  • 6,044
  • 1
  • 14
  • 12
  • It works for serving the web-page, but I get this javascript error concerning the websocket: `Mixed Content: The page at 'https://dertio.herokuapp.com/' was loaded over HTTPS, but attempted to connect to the insecure WebSocket endpoint 'ws://dertio.herokuapp.com/ws'. This request has been blocked; this endpoint must be available over WSS. (anonymous) @ (index):266` – Dup Dup May 11 '18 at 00:00
  • If I set my browser to connect to the websocket (the websocket connection was blocked for being unsafe) , the app works, but the performance is unbelievably slow, any fix for this? – Dup Dup May 11 '18 at 01:35
  • Sorry, but there isn't enough information for me to answer either of those questions - nor really for me to take a guess. – pgjones May 11 '18 at 18:29
  • The websocket runs as you explained in my [previous question](https://stackoverflow.com/questions/49837294/websockets-with-the-python-web-framework-quart), but I don't have a clue whats causing the slowness (It runs fast on localhost). – Dup Dup May 11 '18 at 18:37
  • As it turns out, I can fix the websockets by having my URL as http instead of https. I still don't know why its so slow though. – Dup Dup May 12 '18 at 16:20
  • can i replace all that with ‘hypercorn app:app’? – Abhishta Gatya Mar 08 '19 at 18:42
  • Almost, given the example it would be `hypercorn main_loop:app` – pgjones Mar 08 '19 at 19:49