def main(): QUIET_COMMANDS = ("generate_password_hash", "generate-config") exception = None backup_stderr = sys.stderr # Hack to divert stderr for commands generating content to stdout # to avoid confusing the user if len(sys.argv) > 1 and sys.argv[1] in QUIET_COMMANDS: sys.stderr = open(os.devnull, "w") try: app = create_app() Migrate(app, db) except Exception as e: exception = e # Restore stderr sys.stderr = backup_stderr if exception: raise exception manager = Manager(app) manager.add_command("db", MigrateCommand) manager.add_command("generate_password_hash", GeneratePasswordHash) manager.add_command("generate-config", GenerateConfig) manager.add_command("delete-project", DeleteProject) manager.run()
def main(): app = create_app() Migrate(app, db) manager = Manager(app) manager.add_command('db', MigrateCommand) manager.add_command('generate_password_hash', GeneratePasswordHash) manager.run()
def main(): app = create_app() Migrate(app, db) manager = Manager(app) manager.add_command('db', MigrateCommand) manager.add_command('generate_password_hash', GeneratePasswordHash) manager.add_command('generate-config', ConfigTemplate) manager.run()
def main(): QUIET_COMMANDS = ('generate_password_hash', 'generate-config') backup_stderr = sys.stderr # Hack to divert stderr for commands generating content to stdout # to avoid confusing the user if len(sys.argv) > 1 and sys.argv[1] in QUIET_COMMANDS: sys.stderr = open(os.devnull, 'w') app = create_app() Migrate(app, db) # Restore stderr (among other: to be able to display help) sys.stderr = backup_stderr manager = Manager(app) manager.add_command('db', MigrateCommand) manager.add_command('generate_password_hash', GeneratePasswordHash) manager.add_command('generate-config', GenerateConfig) manager.run()
def main(): QUIET_COMMANDS = ('generate_password_hash', 'generate-config') backup_stderr = sys.stderr # Hack to divert stderr for commands generating content to stdout # to avoid confusing the user if len(sys.argv) > 1 and sys.argv[1] in QUIET_COMMANDS: sys.stderr = open(os.devnull, 'w') app = create_app() Migrate(app, db) # Restore stderr (among other: to be able to display help) sys.stderr = backup_stderr manager = Manager(app) manager.add_command('db', MigrateCommand) manager.add_command('generate_password_hash', GeneratePasswordHash) manager.add_command('generate-config', GenerateConfig) manager.add_command('delete-project', DeleteProject) manager.run()
def create_app(self): # Pass the test object as a configuration. return create_app(self)
from ihatemoney.run import create_app application = create_app()