sqlalchemy.exc.OperationalError: (OperationalError) unable to open database file None None sqlalchemy.exc.OperationalError: (OperationalError) unable to open database file None None database database

sqlalchemy.exc.OperationalError: (OperationalError) unable to open database file None None


Replace:

app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:////dbdir/test.db'

With:

app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///dbdir/test.db'


finally figured it out, had help tho

 import osfile_path = os.path.abspath(os.getcwd())+"\database.db"app = Flask(__name__)app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///'+file_path db = SQLAlchemy(app)


I had this issue with sqlite. The process trying to open the database file needs to have write access to the directory as it creates temporary/lock files.

The following structure worked for me to allow www-data to use the database.

%> ls -ldrwxrwxr-x  2 fmlheureux www-data     4096 Feb 17 13:24 database-dir%> ls -l database-dir/-rw-rw-r-- 1 fmlheureux www-data 40960 Feb 17 13:28 database.sqlite