def load_spatialite_sql(db_name, verbosity=1):
    # Getting the location of the SpatiaLite SQL file, and confirming
    # it exists.
    spatialite_sql = spatialite_init_file()
    if not os.path.isfile(spatialite_sql):
        raise Exception('Could not find the SpatiaLite initialization SQL file: %s' % spatialite_sql)

    # Opening up the SpatiaLite SQL initialization file and executing
    # as a script.
    sql_fh = open(spatialite_sql, 'r')
    try:
        cur = connection.cursor()
        cur.executescript(sql_fh.read())
    finally:
        sql_fh.close()
This routine loads up the SpatiaLite SQL file.
dataset/ETHPy150Open CollabQ/CollabQ/vendor/django/contrib/gis/db/backend/spatialite/creation.py/load_spatialite_sql