(login)
Seed the database with an admin user.
Seed the database with an admin user.
Seed the database with an admin user .
def create_login(login):
    """
    Seed the database with an admin user.
    """

    print 'creating admin user'

    if Administrator.query.filter_by(login=login).count():
        print 'user already exists!'
        return

    # Check env for credentials (used by docker)
    docker_admin_pass = os.getenv('DOCKER_ADMIN_PASS', None)
    if docker_admin_pass:
        admin_user = Administrator(login=login, password=docker_admin_pass)
    else:
        # else, ask on stdin:
        while True:
            print "{}, enter your password!\n ".format(login)
            pw1 = getpass.getpass()
            pw2 = getpass.getpass(prompt="Confirm: ")

            if pw1 == pw2:
                admin_user = Administrator(login=login, password=pw1)
                break
            else:
                print 'passwords do not match!'

    db.session.add(admin_user)
    db.session.commit()
    print 'user: ' + login + ' created!'
def create_login ( login ) : print 'creating admin user' if Administrator . query . filter_by ( login = login ) . count ( ) : print 'user already exists!' return # Check env for credentials (used by docker) docker_admin_pass = os . getenv ( 'DOCKER_ADMIN_PASS' , None ) if docker_admin_pass : admin_user = Administrator ( login = login , password = docker_admin_pass ) else : # else, ask on stdin: while True : print "{}, enter your password!\n " . format ( login ) pw1 = getpass . getpass ( ) pw2 = getpass . getpass ( prompt = "Confirm: " ) if pw1 == pw2 : admin_user = Administrator ( login = login , password = pw1 ) break else : print 'passwords do not match!' db . session . add ( admin_user ) db . session . commit ( ) print 'user: ' + login + ' created!'