0

I am trying to deploy my flask app on Microsoft Azure. On the deployed site it can read the db fine, but whenever I try to write to the db, it gives: sqlalchemy.exc.OperationalError: (sqlite3.OperationalError) database is locked

My file structure inside the app folder is:

  • templates
  • app.py
  • db.sqlite

However when i run it on my local, everything works fine. Any ideas how I can solve this?

mia Zhang
  • 1
  • 3

1 Answers1

0

There is not more information for us to help fixing your issue, such as the necessary code and configuration for using SQLAlchemy with SQLite.

So I suggest that you can carefully refer to the some topics about SQLite locked file for writing.

  1. Database Locking Behavior / Concurrency
  2. The items Client/Server Applications and High Concurrency of the section Situations Where A Client/Server RDBMS May Work Better in the SQLite offical page Appropriate Uses For SQLite.

Meanwhile, some existing SO threads may will help you.

  1. sqlite3.OperationalError: database is locked
  2. SQLAlchemy and SQLite: database is locked

Hope it helps. If you can update your description to post more helpful information, I will try to reproduce your issue and fix it, and then update my post.

Peter Pan
  • 23,476
  • 4
  • 25
  • 43