Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Python sqlite absolute path to database
package_dir = os.path.abspath(os.path.dirname(__file__))
db_dir = os.path.join(package_dir, 'nd_slack.db')
# NEED 4 /'s to specify absolute for sqlalchemy!
# ex: sqlite:////asdfaijegoij/aerga.db
# NEED 3 /'s for relative paths
# path has a / at the beginning so we have 3 here
SQLITE_DB = ''.join(['sqlite:///', db_dir])

This comment has been minimized.

Copy link

@volokolamskspb volokolamskspb commented Feb 28, 2018

Great, thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment