emmett-framework / granian

A Rust HTTP server for Python applications
BSD 3-Clause "New" or "Revised" License
2.67k stars 79 forks source link

Granian on django doesn't work with heroku #175

Closed madhanrajan closed 8 months ago

gi0baro commented 8 months ago

Do you run Django in ASGI or WSGI?

madhanrajan commented 8 months ago

wsgi

gi0baro commented 8 months ago

@madhanrajan can you provide more details on the error, like how you launch granian and stacktrace/logs?

madhanrajan commented 8 months ago

I run it with this command in the Procfile web: granian --interface wsgi project.asgi:application

I encountered an error indicating that the server listened to the port but timed out

gi0baro commented 8 months ago

@madhanrajan there's something wrong in your command, as you specified WSGI protocol but pointed granian to the ASGI interface.

madhanrajan commented 8 months ago

sorry, I did use wsgi but it still didn't work. Could you try replicating this on a heroku instance?

gi0baro commented 8 months ago

@madhanrajan no, I'm sorry, I don't have any quick way to replicate this on Heroku. If you can provide at least some logs we can try to better understand what's happening.

cyb3rs3ntry commented 8 months ago

@madhanrajan - have you tried setting the host to 0.0.0.0 instead of 127.0.0.1

foarsitter commented 8 months ago

@madhanrajan it is very brutal to fill in an issue without an error. Especially when the error is very clear:

Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launch

Heroku assigns a random port to $PORT and needs to be bind to the outside world. I tested it with the following command and it works as intentend.

granian --interface wsgi --port $PORT --host 0.0.0.0 server:app