I’ve changed somethings on my local Flask app to adapt it when deploying like installing gunicorn and adding:
"if __name__ == "__main__":
app.run(host='0.0.0.0', port=os.environ.get('PORT', 8080))"
to properly run my webapp. After a successful deployment I go to the default DigitalOcean url for the app and I see this message: “We encountered an error when trying to load your application and your page could not be served. Check the logs for your application in the App Platform dashboard.”
In my runtime logs I just see this:
[bookingssite] [2024-05-09 13:44:11] [2024-05-09 13:44:11 +0000] [1] [INFO] Listening at: http://0.0.0.0:8080 (1)
[bookingssite] [2024-05-09 13:44:11] [2024-05-09 13:44:11 +0000] [1] [INFO] Using worker: sync
[bookingssite] [2024-05-09 13:44:12] [2024-05-09 13:44:12 +0000] [18] [INFO] Booting worker with pid: 18
and then a lot of booting workers. This is how I load my sqlite database:
app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///' + os.path.join(basedir, 'data.sqlite')
app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False
db = SQLAlchemy(app)
Migrate(app,db)
I’ve also selected the right port when setting up the app platform. What’s the problem here?
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
Hey!
I think that the issue might be with the SQLite database. The storage on the DigitalOcean App Platform is ephemeral, meaning that every time you do a new deployment, anything that you’ve stored on the local storage will be lost.
For persistent data, you should consider using an actual database instead like a Managed Postgres instance or the App Platform dev databases:
https://docs.digitalocean.com/products/app-platform/how-to/manage-databases/
Let me know how it goes!
Best,
Bobby
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.