From ab0788ba22b91bc196053d9955fa7b6fb6aeacac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20=27Necoro=27=20Neumann?= Date: Sat, 9 Jan 2016 23:15:48 +0100 Subject: Use flask-script for commandos --- index.py | 20 -------------------- manage.py | 25 +++++++++++++++++++++++++ 2 files changed, 25 insertions(+), 20 deletions(-) delete mode 100755 index.py create mode 100755 manage.py diff --git a/index.py b/index.py deleted file mode 100755 index af0516b..0000000 --- a/index.py +++ /dev/null @@ -1,20 +0,0 @@ -#!/usr/bin/python2 -# -*- coding: utf-8 -*- - -import sys - -from app import app, db - -try: - cmd = sys.argv[1] -except IndexError: - cmd = None - -if cmd == 'create': - db.create_all() -elif cmd == 'drop': - db.drop_all() -elif cmd == 'compile': - app.jinja_env.compile_templates('comp', zip = None) -else: - app.run() diff --git a/manage.py b/manage.py new file mode 100755 index 0000000..9b26212 --- /dev/null +++ b/manage.py @@ -0,0 +1,25 @@ +#!/usr/bin/python2 +# -*- coding: utf-8 -*- + +import sys + +from app import app, db +from flask.ext.script import Manager + +manager = Manager(app) + +@manager.command +def create(): + db.create_all() + +@manager.command +def drop(): + db.drop_all() + +@manager.command +def compile(): + """Compiles all templates.""" + app.jinja_env.compile_templates('comp', zip = None) + +if __name__ == "__main__": + manager.run(default_command="runserver") -- cgit v1.2.3