Created
January 5, 2016 23:48
-
-
Save woodphil/32bc2c7aa37282664ee9 to your computer and use it in GitHub Desktop.
Python sqlite absolute path to database
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Great, thanks