Deploying flask on app platform doesn't work after deploying

I’ve changed somethings on my local Flask app to adapt it when deploying like installing gunicorn and adding:

"if __name__ == "__main__":'', 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: (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')
db = SQLAlchemy(app)

I’ve also selected the right port when setting up the app platform. What’s the problem here?

Submit an answer

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!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Bobby Iliev
Site Moderator
Site Moderator badge
May 11, 2024


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:

Let me know how it goes!



Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up

Featured on Community

Get our biweekly newsletter

Sign up for Infrastructure as a Newsletter.

Hollie's Hub for Good

Working on improving health and education, reducing inequality, and spurring economic growth? We'd like to help.

Become a contributor

Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

Welcome to the developer cloud

DigitalOcean makes it simple to launch in the cloud and scale up as you grow — whether you're running one virtual machine or ten thousand.

Learn more
DigitalOcean Cloud Control Panel