diff --git a/mocha_server.py b/mocha_server.py index 536f204..bc7729d 100755 --- a/mocha_server.py +++ b/mocha_server.py @@ -4,11 +4,13 @@ Handle API requests to the database """ import json import sqlite3 +from os import path # NOTE: closing a database makes the next query in a script not work -# DATABASE = '/usr/local/www/mocha-server/mocha.db' -DATABASE = 'mocha.db' +DATABASE = '/usr/local/www/mocha-server/mocha.db' +if not path.exists(DATABASE): + DATABASE = 'mocha.db' conn = sqlite3.connect(DATABASE) conn.row_factory = sqlite3.Row