user3873617
user3873617

Reputation: 394

Deploying Flask App with sqlite db in AWS Elastic Beanstalk

I have the tutorial app from the flask docs and modified for my use.

I was able to deploy my flask app and create the db via container_commands (flask init-db)

But when I try to write something to the db from the web browser. It throws the exception that

"sqlite3.OperationalError: attempt to write a readonly database"

It seems the problem is the write permission to the sqlite file. But it was created at the time of deploying the application. Any help. Ideally when you are deploying in your own production env (not cloud), the sqlite is created in the venv/var/app-instance folder. How do I access this in AWS EB.

Upvotes: 2

Views: 1398

Answers (1)

Arun Kamalanathan
Arun Kamalanathan

Reputation: 8593

It looks like file write permission issue to me as well.

here is how i would troubleshoot the issue:

  • login to the instance via ssh, give permission to the file and see if it resolves the issue.
  • if it does resolves the issue, I would automate that using .ebextensions

Hope this helps you move forward.

Also look at the reference below shows how to change file permissions.

Reference: python sqlite3 OperationalError: attempt to write a readonly database

Upvotes: 1

Related Questions