diff options
author | René 'Necoro' Neumann <necoro@necoro.net> | 2016-01-09 23:15:48 +0100 |
---|---|---|
committer | René 'Necoro' Neumann <necoro@necoro.net> | 2016-01-19 01:09:19 +0100 |
commit | ab0788ba22b91bc196053d9955fa7b6fb6aeacac (patch) | |
tree | e6c96d73d0ce2a495f9fd722edd6fe74b037e263 | |
parent | 7963d41a8bef65205e7507b36c11383ce68298ed (diff) | |
download | kosten-ab0788ba22b91bc196053d9955fa7b6fb6aeacac.tar.gz kosten-ab0788ba22b91bc196053d9955fa7b6fb6aeacac.tar.bz2 kosten-ab0788ba22b91bc196053d9955fa7b6fb6aeacac.zip |
Use flask-script for commandos
Diffstat (limited to '')
-rwxr-xr-x | index.py | 20 | ||||
-rwxr-xr-x | manage.py | 25 |
2 files changed, 25 insertions, 20 deletions
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") |