def create_app(self): """ Create a Flask app for testing. """ from gematria_api import create_app self.app = create_app() self.app.config['TESTING'] = True self.app.config['WTF_CSRF_ENABLED'] = False return self.app
#!/usr/bin/env python # -*- coding: utf-8 -*- import sys import traceback sys.path.insert(0, '.') from flask.ext.script import Manager, Shell, Server from gematria_api import create_app from gematria_api import codices app = create_app() def _make_context(): return dict(app=app) manager = Manager(app) manager.add_command("shell", Shell(make_context=_make_context)) manager.add_command("runserver", Server(port=app.config['PORT'])) @manager.command def english_codex_simple(phrase): """ Invokes the simple English codex on phrase. :param phrase: Str """ codex = codices.BaseCodex() print(codex.decode(phrase))