Commit aca25b4c36c9d6d08a4e33f0eb64ac1bf571317f

moved db settings to text file
  
3434"""
3535
3636# Connect to database
37db_host = 'localhost' #192.168.2.180
38db_name = 'feeds'
39db_user = 'feeds'
40db_passwd = 'qtHB85cSzSLW6ppP'
37db_settings_path = os.path.dirname(__file__) + '/config.txt'
38if not os.path.isfile(db_settings_path):
39 print 'ERROR: Please create config.txt for db settings'
40 exit()
41
42db_settings = {}
43for line in open(db_settings_path):
44 if not line.startswith(('#', '//')):
45 setting = line.strip().split(' ',1)
46 db_settings[setting[0]] = setting[1]
47
48db_host = db_settings['db_host']
49db_name = db_settings['db_name']
50db_user = db_settings['db_user']
51db_passwd = db_settings['db_passwd']
52
4153conn = MySQLdb.Connection(host=db_host, db=db_name, user=db_user,
4254 passwd=db_passwd, charset='utf8')
4355cursor = conn.cursor()
  
1db_host localhost
2db_name orator
3db_user joesmith
4db_passwd thisisespeciallysecret