diff --git a/lyrics/db/__init__.py b/lyrics/db/__init__.py index b9840c2..f4f8e6c 100644 --- a/lyrics/db/__init__.py +++ b/lyrics/db/__init__.py @@ -1,7 +1,20 @@ +#!/usr/bin/env python +# -*- encoding: utf-8 -*- + +"""Database models and functions.""" + from datetime import date from pony.orm import * -db = Database("sqlite", "lyrics.sqlite", create_db=True) +import inspect +import os.path + +file_path = inspect.getsourcefile(self) +file_path = os.path.dirname(file_path) + +db = Database("sqlite", + os.path.join(file_path, "lyrics.sqlite"), + create_db=True) class Artist(db.Entity): name = Required(unicode)