Flask OperationalError: unable to open database file using sqlite3
I think that the problem is the ~
character (valid in shell but not in Python), so you will probably need to write the full absolute path. I am not using Flask but I suggest to set up PROJECT_ROOT constant in your settings and then use relative paths:
import osPROJECT_ROOT = os.path.dirname(os.path.realpath(__file__))DATABASE = os.path.join(PROJECT_ROOT, 'tmp', 'test.db')