I’m having some trouble. I don’t know how to proper deploy a Flask app I’ve made (and runs well locally).
It’s a somewhat complex app, so I didn’t used app.py but a __init__.py module with Blueprints. The problem is that I always get ModuleNotFoundError: No module named 'app' at the deploy. I am a beginner, but the other two apps I’ve made run beautifully on Render (but they are smaller, so everything is inside app.py).
I’ve tried to create a environment variable called “FLASK_APP=init.py” but it didn’t worked. What should I do?
Hey, not sure what’s wrong, but it could be a file pathing issue. You might be able to solve it by putting init.py in an “app” folder. It’s been a while since I’ve used flask, so without seeing your codebase, I’m unable to identify the issue. Maybe someone from the Render team who has access can help?
The solution was to reorganize the files and change the build command. The build command should be gunicorn "directoryname:create_app()" (in my case, directoryname = watchlist) and the files was reorganized as follows: