Outdated docs on http to https redirection
dfb opened this issue · comments
Is there an existing issue for this?
- I have searched the existing issues
Describe the bug
I needed to set up http-to-https redirection for my app and came across this:
But it fails because is_running
isn't a member of Sanic
. I changed it to instead use app.state.is_running
and then the second app would start ok, but my catchall route (or any route) could be found. I then replaced the signalize
and finalize
lines with:
await server.startup()
and now everything works.
Code snippet
My final runner function that works looks like this:
async def _RunServer(app, server):
app.state.is_running = True
try:
await server.startup()
await server.serve_forever()
finally:
app.state.is_running = False
app.state.is_stopping = True
Expected Behavior
I think the docs need to be updated to something like the above changes, but maybe even this approach is outdated? I found #2348 but am not sure if that's what I should be doing instead. Thanks!
How do you run Sanic?
Sanic CLI
Operating System
Linux
Sanic Version
23.6.0
Additional context
No response