Python Flask SQLite
howesc
HOBBYOP

a year ago

Hi there, hope you can help

My Flask app uses a SQLite database referenced within my application like this:

DB_PATH = './_vol/db.sqlite'

In my Railway app, I've created a volume at /app/_vol.

My Procfile looks like this:

release: python sqlite_db.py

web: gunicorn server:app

The release step is supposed to create the database, but it fails during Build:

sqlite3.OperationalError: unable to open database file

The line that fails is this:

conn = sqlite3.connect(DB_PATH)

Solved

2 Replies

a year ago

Volume access is not provided at the build step. You should look into using pre deploy commands for this: https://docs.railway.com/guides/pre-deploy-command


Status changed to Awaiting User Response Railway about 1 year ago


howesc
HOBBYOP

a year ago

This works, thank you so much


Status changed to Awaiting Railway Response Railway about 1 year ago


Status changed to Solved nico about 1 year ago


Welcome!

Sign in to your Railway account to join the conversation.

Loading...