From 27f0bead73dc8d83f249cf288d63ec92d6004289 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20=27Necoro=27=20Neumann?= Date: Sun, 12 Feb 2017 12:20:16 +0100 Subject: No need for flask-script anymore; flask provides this out of the box --- app/__init__.py | 14 ++++++++++++++ manage.py | 28 ---------------------------- manage.sh | 3 +++ 3 files changed, 17 insertions(+), 28 deletions(-) delete mode 100755 manage.py create mode 100755 manage.sh diff --git a/app/__init__.py b/app/__init__.py index 61841ca..0a02ed4 100644 --- a/app/__init__.py +++ b/app/__init__.py @@ -15,3 +15,17 @@ app.config.from_pyfile('settings.py') from .model import db from .login import login_manager from . import views + +# commands +@app.cli.command() +def create(): + db.create_all() + +@app.cli.command() +def drop(): + db.drop_all() + +@app.cli.command() +def compile(): + """Compiles all templates.""" + app.jinja_env.compile_templates('comp', zip = None) diff --git a/manage.py b/manage.py deleted file mode 100755 index 9efe083..0000000 --- a/manage.py +++ /dev/null @@ -1,28 +0,0 @@ -#!/usr/bin/python3 -B -# -*- coding: utf-8 -*- - -import sys - -from app import app, db -from flask.ext.script import Manager -from flask.ext.migrate import Migrate, MigrateCommand - -migrate = Migrate(app, db) -manager = Manager(app) -manager.add_command('db', MigrateCommand) - -@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") diff --git a/manage.sh b/manage.sh new file mode 100755 index 0000000..28d0428 --- /dev/null +++ b/manage.sh @@ -0,0 +1,3 @@ +#!/bin/sh + +PYTHONDONTWRITEBYTECODE=x FLASK_APP=__init__.py flask "$@" -- cgit v1.2.3