Example #1
0
def setup():
    """
    Creates/bootstraps the database.

    If you're a real developer you'll figure out how to remove the
    warning yourself. Don't merge any code the removes it.
    """
    is_devel = options.setup.startswith("dev")
    if is_devel:
        print("%sWARNING:%s Setup is in development mode %s" % (WARN + bold, W, WARN))
        message = "I know what the f**k I am doing"
        resp = input(PROMPT + 'Please type "%s": ' % message)
        if resp.replace('"', "").lower().strip() != message.lower():
            os._exit(1)
    else:
        is_devel = options.setup.startswith("docker")
    print(INFO + "%s : Creating the database ..." % current_time())
    from setup.create_database import create_tables, engine, metadata

    create_tables(engine, metadata, is_devel)
    print(INFO + "%s : Bootstrapping the database ..." % current_time())
    import setup.bootstrap

    # Display Details
    if is_devel:
        environ = bold + R + "Development boot strap:" + G
        details = "Admin Password is 'rootthebox'" + W
    else:
        environ = bold + "Production boot strap" + W
        details = ""
    from handlers import update_db

    update_db(False)
    print(INFO + "%s %s" % (environ, details))
Example #2
0
def setup():
    '''
    Creates/bootstraps the database.

    If you're a real developer you'll figure out how to remove the
    warning yourself. Don't merge any code the removes it.
    '''
    is_devel = options.setup.startswith('dev')
    if is_devel:
        print("%sWARNING:%s Setup is in development mode %s" % (
            WARN + bold, W, WARN,
        ))
        message = "I know what the f**k I am doing"
        resp = raw_input(PROMPT + 'Please type "%s": ' % message)
        if resp.replace('"', '').lower().strip() != message.lower():
            os._exit(1)
    print(INFO + '%s : Creating the database ...' % current_time())
    from setup.create_database import create_tables, engine, metadata
    create_tables(engine, metadata, is_devel)
    print(INFO + '%s : Bootstrapping the database ...' % current_time())
    import setup.bootstrap
    # Display Details
    if is_devel:
        environ = bold + R + "Developement boot strap" + W
        details = ", admin password is 'nimda123'."
    else:
        environ = bold + "Production boot strap" + W
        details = '.'
    print(INFO + '%s completed successfully%s' % (environ, details))
Example #3
0
def setup():
    ''' Creates/bootstraps the database '''
    from setup import boot_strapper
    from setup.create_database import create_tables, engine, metadata
    logging.info('Creating the database ...')
    create_tables(engine, metadata, options.log_sql)
    logging.info('Bootstrapping the database ...')
    boot_strapper()
def setup():
    ''' Creates/bootstraps the database '''
    from setup import boot_strapper
    from setup.create_database import create_tables, engine, metadata
    logging.info('Creating the database ...')
    create_tables(engine, metadata, options.log_sql)
    logging.info('Bootstrapping the database ...')
    boot_strapper()
Example #5
0
def setup_database(db_name):
    # Setup the test database
    logging.debug("Setting up the test database connection ...")
    config_manager = ConfigManager.instance()
    config_manager.db_connection = 'sqlite:///%s.db' % db_name
    assert config_manager.db_connection == 'sqlite:///%s.db' % db_name

    # Create the default tables
    logging.debug("Creating tables ... ")
    from setup.create_database import create_tables, engine, metadata
    create_tables(engine, metadata, False)
    import setup.bootstrap
Example #6
0
def setup_database(db_name):
    # Setup the test database
    logging.debug("Setting up the test database connection ...")

    options.sql_dialect = 'sqlite'
    options.sql_database = '%s.db' % db_name

    # Create the default tables
    logging.debug("Creating tables ... ")
    from setup.create_database import create_tables, engine, metadata
    create_tables(engine, metadata, False)
    import setup.bootstrap
Example #7
0
def setup_database(db_name):
    # Setup the test database
    logging.debug("Setting up the test database connection ...")
    config_manager = ConfigManager.instance()
    config_manager.db_connection = 'sqlite:///%s.db' % db_name
    assert config_manager.db_connection == 'sqlite:///%s.db' % db_name

    # Create the default tables
    logging.debug("Creating tables ... ")
    from setup.create_database import create_tables, engine, metadata
    create_tables(engine, metadata, False)
    import setup.bootstrap
Example #8
0
def setup_database(db_name):
    # Setup the test database
    logging.debug("Setting up the test database connection ...")

    options.sql_dialect = 'sqlite'
    options.sql_database = '%s.db' % db_name

    # Create the default tables
    logging.debug("Creating tables ... ")
    from setup.create_database import create_tables, engine, metadata
    create_tables(engine, metadata, False)
    import setup.bootstrap
Example #9
0
def setup():
    """
    Creates/bootstraps the database.

    If you're a real developer you'll figure out how to remove the
    warning yourself. Don't merge any code the removes it.
    """
    is_devel = options.setup.startswith("dev")
    if is_devel:
        print("%sWARNING:%s Setup is in development mode %s" %
              (WARN + bold, W, WARN))
        message = "I know what the f**k I am doing"
        resp = input(PROMPT + 'Please type "%s": ' % message)
        if resp.replace('"', "").lower().strip() != message.lower():
            os._exit(1)
    else:
        is_devel = options.setup.startswith("docker")
    print(INFO + "%s : Creating the database ..." % current_time())
    from setup.create_database import create_tables, engine, metadata

    create_tables(engine, metadata, options.log_sql)
    sys.stdout.flush()

    from models.Theme import Theme

    themes = Theme.all()
    if len(themes) > 0:
        print(INFO + "It looks like database has already been set up.")
        return

    print(INFO + "%s : Bootstrapping the database ..." % current_time())
    import setup.bootstrap

    # Display Details
    if is_devel:
        environ = bold + R + "Development bootstrap:"
        details = C + "Admin Username: admin, Password: rootthebox" + W
    else:
        environ = bold + "Production bootstrap" + W
        details = ""
    from handlers import update_db

    update_db(False)
    sys.stdout.flush()
    try:
        print(INFO + "%s %s" % (environ, details), flush=True)
    except:
        print(INFO + "%s %s" % (environ, details))
Example #10
0
def create():
    ''' Creates/bootstraps the database '''
    from libs.ConfigManager import ConfigManager  # Sets up logging
    print(INFO+'%s : Creating the database ...' % current_time())
    from setup.create_database import create_tables, engine, metadata
    dev = ConfigManager.instance().bootstrap == 'developement'
    create_tables(engine, metadata, dev)
    print(INFO+'%s : Bootstrapping the database ...' % current_time())
    import setup.bootstrap
    # Display Details
    if dev:
        environ = bold + R + "Developement boot strap" + W
        details = ", admin password is 'nimda123'."
    else:
        environ = bold + "Production boot strap" + W
        details = '.'
    print INFO + '%s completed successfully%s' % (environ, details)
Example #11
0
def create():
    ''' Creates/bootstraps the database '''
    from libs.ConfigManager import ConfigManager  # Sets up logging
    print(INFO + '%s : Creating the database ...' % current_time())
    from setup.create_database import create_tables, engine, metadata
    is_devel = ConfigManager.instance().bootstrap.startswith('dev')
    create_tables(engine, metadata, is_devel)
    print(INFO + '%s : Bootstrapping the database ...' % current_time())
    import setup.bootstrap
    # Display Details
    if is_devel:
        environ = bold + R + "Developement boot strap" + W
        details = ", admin password is 'nimda123'."
    else:
        environ = bold + "Production boot strap" + W
        details = '.'
    print(INFO + '%s completed successfully%s' % (environ, details))
Example #12
0
def setup_database():
    """ Creates/bootstraps the database """
    from setup.create_database import create_tables
    logging.info("Creating tables ...")
    create_tables()

    from setup.bootstrap import bootstrap_database
    bootstrap_database()

    # Display Details
    if options.setup.lower().startswith('dev'):
        environ = BOLD + R + "Developement boot strap" + W
        details = ", admin password is 'nimda123'."
    else:
        environ = BOLD + "Production boot strap" + W
        details = '.'
    print(INFO + '%s completed successfully%s' % (environ, details))