From d1f63bf0dbbffa4c660a4baaa95db3b0f670b67c Mon Sep 17 00:00:00 2001 From: j Date: Mon, 11 Aug 2014 19:32:49 +0200 Subject: [PATCH] create db on start/debug if missing --- ctl | 1 - oml/commands.py | 3 ++- oml/server.py | 2 ++ oml/setup.py | 1 + 4 files changed, 5 insertions(+), 2 deletions(-) diff --git a/ctl b/ctl index b44de47..6d90f58 100755 --- a/ctl +++ b/ctl @@ -102,7 +102,6 @@ if [ "$1" == "update" ]; then cd "$BASE/$NAME" find . -name "*.pyc" -exec rm "{}" \; git pull - "$0" setup "$0" update_static > /dev/null NEW=`"$0" version` "$0" postupdate -o $OLD -n $NEW diff --git a/oml/commands.py b/oml/commands.py index 5e82a36..f27f4cd 100644 --- a/oml/commands.py +++ b/oml/commands.py @@ -98,12 +98,13 @@ def command_setup(*args): """ import setup setup.create_db() - setup.create_default_lists() def command_update_static(*args): """ Update static files """ + import setup + setup.create_db() oxjs = os.path.join(settings.static_path, 'oxjs') if not os.path.exists(oxjs): r('git', 'clone', 'https://git.0x2620.org/oxjs.git', oxjs) diff --git a/oml/server.py b/oml/server.py index da7842b..42aee27 100644 --- a/oml/server.py +++ b/oml/server.py @@ -31,6 +31,8 @@ class MainHandler(OMLHandler): serve_static(self, path, 'text/html') def run(): + import setup + setup.create_db() root_dir = os.path.normpath(os.path.join(os.path.abspath(os.path.dirname(__file__)), '..')) PID = sys.argv[2] if len(sys.argv) > 2 else None diff --git a/oml/setup.py b/oml/setup.py index e85dc16..bc11f6c 100644 --- a/oml/setup.py +++ b/oml/setup.py @@ -179,6 +179,7 @@ PRAGMA journal_mode=WAL for statement in sql.split(';'): run_sql(statement) upgrade_db('0') + create_default_lists() def upgrade_db(old, new=None): if new: