def make_celery(app=None): app = app or create_app() ext = FlaskCeleryExt(app) return ext.celery
def setUp(self): self.app = create_app(DevelopmentTestingConfig()) self.app.app_context().push() self.test_client = self.app.test_client() self.db = db
wwoman = User(social_id='321', name='Diana Prince', picture='//').save() now = datetime.datetime.now() p1 = Post(text='I am poor.', date=now, truth=False, author=batman).save() Post(text='I can beat the Superman.', date=now, truth=True, author=batman).save() Post(text='I have no weakness.', date=now, truth=False, author=superman).save() Post(text='I am an Amazonian', date=now, truth=True, author=wwoman).save() Post(text='My car is visible.', date=now, truth=False, author=wwoman).save() Guess(user=superman, post=p1, guess=False).save() Guess(user=wwoman, post=p1, guess=False).save() if __name__ == '__main__': app = create_app(DevelopmentConfig) import sys if '--init-db' in sys.argv: populate_database(app) else: app.run()
from app.instance import create_app, init_db from config import DevelopmentConfig, ProductionConfig if __name__ == '__main__': import sys config = ProductionConfig() if '--init-db' in sys.argv: init_db(config) else: app = create_app(config) app.run()
from app.instance import create_app from app.config import app_config import os application = create_app(app_config[os.getenv('APP_CONFIG')]) application.app_context().push() if __name__ == '__main__': application.run()