예제 #1
0
def models(config_path):
    """ Setup the sqlite db and initialize the models """
    autograder.setup_app(config_path)

    # Now that setup has occurred, we can import the models
    from autograder import models as m

    # Make sure that if we've used a different db setup in another module
    # we don't keep trying to write to that database
    m.db.session.remove()

    m.drop_all()
    m.create_all()
    return m
예제 #2
0
파일: cli.py 프로젝트: khwilson/autograder
def setup_db(recreate):
    from autograder import models as m
    if recreate:
        m.drop_all()
    m.create_all()