R
Railwayβ€’3w ago
gabdlr

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:
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
Jump to solution
8 Replies
Percy
Percyβ€’3w ago
Project ID: N/A
Brody
Brodyβ€’3w ago
does that command work to run the application locally?
gabdlr
gabdlrOPβ€’3w ago
Hey Brody, im not using gunicorn locally
Brody
Brodyβ€’3w ago
you should be testing with that command locally to make sure it works
gabdlr
gabdlrOPβ€’3w ago
60be7e98-2f99-4045-b9f4-a7891af59555 thats a good point
Solution
gabdlr
gabdlrβ€’3w 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
gabdlrOPβ€’3w 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 πŸ‘
Brody
Brodyβ€’3w ago
Awesome glad you could solve
Want results from more Discord servers?
Add your server