Esempio n. 1
0
from app import app
from app import app_config
from database import db
from database import db_models
from util import patches

# Silence pyflakes
assert db_models
assert patches

app_config.init_prod_app(app)

def request_context():
    return app.app_context()

def create_all():
    with request_context():
        db.create_all()

def drop_all():
    with request_context():
        db.drop_all()
from app import app_config
from config import constants

from database import db
from flask import Flask

from logic.emails import email_types

flask_app = Flask(__name__)

flask_app.config.update(broker_url=os.environ['REDIS_URL'],
                        result_backend=os.environ['REDIS_URL'],
                        task_always_eager=os.environ.get(
                            'CELERY_DEBUG', False))

app_config.init_prod_app(flask_app)

import tasks


def backfill_fullcontact(limit=100000):
    with flask_app.app_context():

        # Find users for whom we have no fullcontact info
        unfilled = """
            SELECT DISTINCT presale.email
            FROM presale
                LEFT JOIN fullcontact ON presale.email = fullcontact.email
            WHERE fullcontact.id IS NULL
            LIMIT %d
        """ % (limit)