make database path portable
This commit is contained in:
parent
9e2ff9936b
commit
2245baef3e
1 changed files with 4 additions and 2 deletions
|
@ -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
|
||||
|
|
Reference in a new issue