deploying flask app

gabdlr
HOBBY

8 months ago

hi guys, i recently switched my flask app to a more modular approach using blueprints but now im having issues when trying to deploy i think this the more valuable piece of information in logs: Failed to find attribute 'app' in 'app'.

My project folder structure would be something like /app/init.py as my entrypoint, I have set the FLASK_APP env var to app and i have the procfile with the web: gunicorn app:app --bind 0.0.0.0:$PORT in it, any hints ?

0 Replies

8 months ago

does that command work to run the application locally?


gabdlr
HOBBY

8 months ago

Hey Brody, im not using gunicorn locally


8 months ago

you should be testing with that command locally to make sure it works


gabdlr
HOBBY

8 months ago

60be7e98-2f99-4045-b9f4-a7891af59555


gabdlr
HOBBY

8 months ago

thats a good point


gabdlr
HOBBY

8 months ago

So, it wasn't a kind advice, but it was a good advice, findins: you can't run gunicorn on windows, but you can run it using wsl, as I changed my app to a modular approach the app variable wasn't available because it was created by the factory function in the init.py. Solution, you could move the app = Flask(name) to the outer scope or you can modify your Procfile to web: gunicorn 'app:create_app()' --bind 0.0.0.0:$PORT


gabdlr
HOBBY

8 months ago

Thank you again, i had not use* wsl in a long time, you made me get* my hands dirty 🙂 can be marked as solved 👍


8 months ago

Awesome glad you could solve


deploying flask app - Railway Help Station