Пример #1
0
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()
Пример #2
0
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()
Пример #3
0
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()
Пример #4
0
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()
Пример #5
0
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()
Пример #6
0
 def create_app(self):
     # Pass the test object as a configuration.
     return create_app(self)
Пример #7
0
 def create_app(self):
     # Pass the test object as a configuration.
     return create_app(self)
Пример #8
0
from ihatemoney.run import create_app

application = create_app()