deploying flask app
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 ?
Solution:Jump to solution
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
8 Replies
Project ID:
N/A
does that command work to run the application locally?
Hey Brody, im not using gunicorn locally
you should be testing with that command locally to make sure it works
60be7e98-2f99-4045-b9f4-a7891af59555
thats a good point
Solution
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
Thank you again, i had not use* wsl in a long time, you made me get* my hands dirty π can be marked as solved π
Awesome glad you could solve