create db on start/debug if missing

This commit is contained in:
j 2014-08-11 19:32:49 +02:00
parent cb59b49ee3
commit d1f63bf0db
4 changed files with 5 additions and 2 deletions

1
ctl
View File

@ -102,7 +102,6 @@ if [ "$1" == "update" ]; then
cd "$BASE/$NAME" cd "$BASE/$NAME"
find . -name "*.pyc" -exec rm "{}" \; find . -name "*.pyc" -exec rm "{}" \;
git pull git pull
"$0" setup
"$0" update_static > /dev/null "$0" update_static > /dev/null
NEW=`"$0" version` NEW=`"$0" version`
"$0" postupdate -o $OLD -n $NEW "$0" postupdate -o $OLD -n $NEW

View File

@ -98,12 +98,13 @@ def command_setup(*args):
""" """
import setup import setup
setup.create_db() setup.create_db()
setup.create_default_lists()
def command_update_static(*args): def command_update_static(*args):
""" """
Update static files Update static files
""" """
import setup
setup.create_db()
oxjs = os.path.join(settings.static_path, 'oxjs') oxjs = os.path.join(settings.static_path, 'oxjs')
if not os.path.exists(oxjs): if not os.path.exists(oxjs):
r('git', 'clone', 'https://git.0x2620.org/oxjs.git', oxjs) r('git', 'clone', 'https://git.0x2620.org/oxjs.git', oxjs)

View File

@ -31,6 +31,8 @@ class MainHandler(OMLHandler):
serve_static(self, path, 'text/html') serve_static(self, path, 'text/html')
def run(): def run():
import setup
setup.create_db()
root_dir = os.path.normpath(os.path.join(os.path.abspath(os.path.dirname(__file__)), '..')) 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 PID = sys.argv[2] if len(sys.argv) > 2 else None

View File

@ -179,6 +179,7 @@ PRAGMA journal_mode=WAL
for statement in sql.split(';'): for statement in sql.split(';'):
run_sql(statement) run_sql(statement)
upgrade_db('0') upgrade_db('0')
create_default_lists()
def upgrade_db(old, new=None): def upgrade_db(old, new=None):
if new: if new: