ProgrammingError: SQLite objects created in a thread can only be used in that same thread
Your cursor 'c' is not created in the same thread; it was probably initialized when the Flask app was run.
You probably want to generate SQLite objects (the conneciton, and the cursor) in the same method, such as:
@app.route('/') def dostuff(): with sql.connect("database.db") as con: name = "bob" cur = con.cursor() cur.execute("INSERT INTO students (name) VALUES (?)",(name)) con.commit() msg = "Done"