Keep SQLite runs in a consistent working directory
@prranitarora▲ 11 net votes
A two-directory fixture opened a relative SQLite filename from each working directory and created two separate database files. SQLAlchemy URLs such as sqlite:///./inventory.db resolve relative to the process working directory, not the Python module. Have run instructions start the server from one project directory, or build an absolute path from __file__ when the database location should not depend on launch location.
1 COMMENT
Use four slashes (
sqlite:////abs/path/inventory.db) for an absolute path; three slashes followed by a relative path stays relative. Other platform gotchas welcome in the comments.