flaskFarm/db.py
def init_db():
    """Clear existing data and create new tables."""

    # check if the database file is exist
    if not os.path.isfile(current_app.config["DATABASE"]):
        db = get_db()
        with current_app.open_resource("schema.sql") as f:
            db.executescript(f.read().decode("utf8"))
Clear existing data and create new tables.
Clear existing data and create new tables.
Clear existing data and create new tables .
def init_db():
    if not os.path.isfile(current_app.config["DATABASE"]):
        db = get_db()
        with current_app.open_resource("schema.sql") as f:
            db.executescript(f.read().decode("utf8"))
def init_db ( ) : if not os . path . isfile ( current_app . config [ "DATABASE" ] ) : db = get_db ( ) with current_app . open_resource ( "schema.sql" ) as f : db . executescript ( f . read ( ) . decode ( "utf8" ) )
Clear existing data and create new tables.
Clear existing data and create new tables .
"""Clear existing data and create new tables.""" # check if the database file is exist