import os import sys import subprocess from flask.ext.script import Manager from alembic import command from alembic.config import Config from flask.ext.assets import ManageAssets from call_server.app import create_app from call_server.extensions import assets, db, cache from call_server import political_data from call_server.user import User, USER_ADMIN, USER_ACTIVE app = create_app() app.db = db manager = Manager(app) alembic_config = Config( os.path.realpath(os.path.dirname(__name__)) + "/alembic.ini") # let the config override the default db location in production alembic_config.set_section_option('alembic', 'sqlalchemy.url', app.config.get('SQLALCHEMY_DATABASE_URI')) manager.add_command("assets", ManageAssets()) def reset_assets(): """Reset assets named bundles to {} before running command. This command should really be run with TestingConfig context""" print "resetting assets"
import logging from flask_script import Manager, Command import alembic import alembic.config, alembic.command from flask_assets import ManageAssets from flask_rq2.script import RQManager from call_server.app import create_app from call_server.extensions import assets, db, cache from call_server import political_data from call_server.user import User, USER_ADMIN, USER_ACTIVE log = logging.getLogger(__name__) app = create_app() app.db = db manager = Manager(app) manager.add_command('rq', RQManager(app.rq)) alembic_config = alembic.config.Config(os.path.realpath(os.path.dirname(__name__)) + "/alembic.ini") # let the config override the default db location in production alembic_config.set_section_option('alembic', 'sqlalchemy.url', app.config.get('SQLALCHEMY_DATABASE_URI')) manager.add_command("assets", ManageAssets()) def reset_assets(): """Reset assets named bundles to {} before running command. This command should really be run with TestingConfig context"""
def create_app(self): assets._named_bundles = {} return create_app(TestingConfig)
def create_app(self): assets._named_bundles = {} return create_app(TestingConfig)
# TODO, figure out how to load gevent monkey patch cleanly in production # try: # from gevent.monkey import patch_all # patch_all() # import psycogreen.gevent # psycogreen.gevent.patch_psycopg() # except ImportError: # print("unable to apply gevent monkey.patch_all") import os from werkzeug.contrib.fixers import ProxyFix from call_server.app import create_app from call_server.extensions import assets assets._named_bundles = {} application = create_app() # requires application context assets.auto_build = False application.wsgi_app = ProxyFix(application.wsgi_app)