Flask app: switching from main:app to main:create_app()
gpt
PROOP

2 years ago

Hi there,

I have a basic question about entrypoints to Flask/Gunicorn.

I have a Flask project on Railway that was successfully deploying when my project structure had a main.py file that directly created an app variable at the top level. The entry command was gunicorn main:app.

I needed to update this structure to include a create_app function, which returns the app variable, because of some issues with my test environment.

I then updated the start command to gunicorn main:create_app(), but it's hanging infinitely and failing to start. Am I doing something wrong?

Thanks.

View Deploy details

ⓘ Deployment information is only viewable by Project members and Railway admins.

Solved

4 Replies

2 years ago

Does gunicorn main:create_app() work locally?


gpt
PROOP

2 years ago

ugh, good catch - I think only gunicorn main:create_app works locally, so i'm trying that on Railway now :)


gpt
PROOP

2 years ago

Resolved! That helped to debug it. I ended up going with gunicorn "main:create_app()" which deployed locally, and then it worked fine on Railway. Thank you :)


Status changed to Solved Railway almost 2 years ago


2 years ago

No problem!


Loading...