def create_app(self): '''Start the wsgi application''' from vault_service import app a = app.create_app(**{ 'SQLALCHEMY_DATABASE_URI': self.postgresql_url, 'SQLALCHEMY_ECHO': False, 'TESTING': True, 'PROPAGATE_EXCEPTIONS': True, 'TRAP_BAD_REQUEST_ERRORS': True }) return a
def create_app(self): '''Start the wsgi application''' a = app.create_app(**{ 'SQLALCHEMY_DATABASE_URI': self.postgresql_url, 'SQLALCHEMY_ECHO': True, 'TESTING': True, 'PROPAGATE_EXCEPTIONS': True, 'TRAP_BAD_REQUEST_ERRORS': True, 'VAULT_BUMBLEBEE_OPTIONS': {'foo': 'bar'} }) return a
def get_app_config(key): opath = os.path.abspath(os.path.join(os.path.dirname(__file__), '..')) if opath not in sys.path: sys.path.insert(0, opath) from vault_service import app as application app = application.create_app() with app.app_context() as c: print 'Getting actual config for', key, app.config.get(key) return app.config.get(key)
def create_app(self): '''Start the wsgi application''' a = app.create_app(**{ 'SQLALCHEMY_DATABASE_URI': 'sqlite:///', 'SQLALCHEMY_ECHO': True, 'TESTING': True, 'PROPAGATE_EXCEPTIONS': True, 'TRAP_BAD_REQUEST_ERRORS': True, 'VAULT_BUMBLEBEE_OPTIONS': {'foo': 'bar'} }) return a
def create_app(self): '''Start the wsgi application''' a = app.create_app( **{ 'SQLALCHEMY_DATABASE_URI': 'sqlite:///', 'SQLALCHEMY_ECHO': False, 'TESTING': True, 'PROPAGATE_EXCEPTIONS': True, 'TRAP_BAD_REQUEST_ERRORS': True }) Base.query = a.db.session.query_property() return a
from werkzeug.serving import run_simple from vault_service import app application = app.create_app() if __name__ == "__main__": run_simple('0.0.0.0', 5000, application, use_reloader=False, use_debugger=False)
from flask_cors import CORS from vault_service.app import create_app if __name__ == '__main__': app = create_app() cors = CORS(app, allow_headers=('Content-Type', 'Authorization', 'X-BB-Api-Client-Version')) app.run('0.0.0.0', port=5000, debug=True)
import json import os import sys import psycopg2 from itertools import islice from sqlalchemy.orm import exc as ormexc from sqlalchemy import create_engine from sqlalchemy.orm import sessionmaker from flask import current_app from flask.ext.script import Manager, Command, Option from adsmutils import setup_logging, load_config, ADSFlask from vault_service.views.utils import upsert_myads from vault_service import app from vault_service.models import MyADS app_ = app.create_app() manager = Manager(app_) @manager.option('-f', '--file', dest='filename', default=None) @manager.option('-i', '--import', dest='do_import', default=False) @manager.option('-e', '--email', dest='email_address', default=None) @manager.option('-r', '--force', dest='force', default=False) @manager.option('-v', '--verbose', dest='verbose', default=False) @manager.option('-t', '--testing', dest='testing', default=False) def import_from_classic(filename=None, do_import=False, email_address=None, force=False, verbose=False, testing=False): with open(filename) as json_file: data = json.load(json_file) if email_address: try: