Forums

Flask/SQLAlchemy giving me error: Unable to open database

.

app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:////home/TreyThomas673/FDStatus/AllDept.db'

app.config['SQLALCHEMY_BINDS'] = 
({'personneldb':'sqlite:////home/TreyThomas673/FDStatus/AllPersonnel.db',
'aparatusdb':'sqlite:////home/TreyThomas673/FDStatus/AllAparatus.db'})

2018-05-07 21:48:58,775: [2018-05-07 21:48:58,769] ERROR in app: Exception on /login [GET]
2018-05-07 21:48:58,775: Traceback (most recent call last):
2018-05-07 21:48:58,776:   File "/usr/local/lib/python3.6/dist-packages/sqlalchemy/engine/base.py", line 2138, in _wrap_pool_connect
2018-05-07 21:48:58,776:     return fn()
2018-05-07 21:48:58,776:   File "/usr/local/lib/python3.6/dist-packages/sqlalchemy/pool.py", line 387, in connect
2018-05-07 21:48:58,776:     return _ConnectionFairy._checkout(self)
2018-05-07 21:48:58,776:   File "/usr/local/lib/python3.6/dist-packages/sqlalchemy/pool.py", line 766, in _checkout
2018-05-07 21:48:58,777:     fairy = _ConnectionRecord.checkout(pool)
2018-05-07 21:48:58,777:   File "/usr/local/lib/python3.6/dist-packages/sqlalchemy/pool.py", line 516, in checkout
2018-05-07 21:48:58,777:     rec = pool._do_get()
2018-05-07 21:48:58,777:   File "/usr/local/lib/python3.6/dist-packages/sqlalchemy/pool.py", line 1229, in _do_get
2018-05-07 21:48:58,777:     return self._create_connection()
2018-05-07 21:48:58,777:   File "/usr/local/lib/python3.6/dist-packages/sqlalchemy/pool.py", line 333, in _create_connection
2018-05-07 21:48:58,778:     return _ConnectionRecord(self)
2018-05-07 21:48:58,778:   File "/usr/local/lib/python3.6/dist-packages/sqlalchemy/pool.py", line 461, in __init__
2018-05-07 21:48:58,778:     self.__connect(first_connect_check=True)
2018-05-07 21:48:58,778:   File "/usr/local/lib/python3.6/dist-packages/sqlalchemy/pool.py", line 651, in __connect
2018-05-07 21:48:58,778:     connection = pool._invoke_creator(self)
2018-05-07 21:48:58,779:   File "/usr/local/lib/python3.6/dist-packages/sqlalchemy/engine/strategies.py", line 105, in connect
2018-05-07 21:48:58,779:     return dialect.connect(*cargs, **cparams)
2018-05-07 21:48:58,779:   File "/usr/local/lib/python3.6/dist-packages/sqlalchemy/engine/default.py", line 393, in connect
2018-05-07 21:48:58,779:     return self.dbapi.connect(*cargs, **cparams)
2018-05-07 21:48:58,779: sqlite3.OperationalError: unable to open database file

This was working, but now it just stopped working.

[edit by admin: formatting]

I'm guessing that you're just not using the correct path to your database file. Make sure that there is actually a file at the path that you're specifying.