Implements automatic way to find config file without providing path

Removes database files from repo.
This commit is contained in:
Julien Lengrand-Lambert
2013-01-22 12:21:47 +01:00
parent ddd9171d0b
commit 35e2999c18
3 changed files with 6 additions and 3 deletions

1
.gitignore vendored
View File

@@ -4,3 +4,4 @@ basic.keys
lib_tests/tweepy lib_tests/tweepy
*.pyc *.pyc
test.py test.py
*.db

View File

@@ -9,7 +9,7 @@ engine=sqlite:///twiderboard.db
[log] [log]
debug=False debug=Falsez
name=board.log name=board.log
[keys] [keys]

View File

@@ -3,12 +3,14 @@
from ConfigParser import SafeConfigParser from ConfigParser import SafeConfigParser
import os import os
import sys
# FIXME: find how to read it from anywhere. # FIXME: find how to read it from anywhere.
#(without having to be in correct folder) #(without having to be in correct folder)
parser = SafeConfigParser() parser = SafeConfigParser()
parser.read('basic.ini') # ini file should be located one folder up from data module (in main repo)
ini_path = os.path.join(os.path.dirname(os.path.dirname( __file__ )), 'basic.ini')
parser.read(ini_path)
# Base : # Base :
engine_url = parser.get('base', 'engine') engine_url = parser.get('base', 'engine')