title: Python Flask and sqlite3 commit not working
body: <p>This is just a small bite of my code but I hope it will be enough so solve my problem. Allow me to explain first.</p>
  
  <p>So I am attempting to store information in a database using python and sqlite3. I can store stuff in the database but the file size of the database never increases and after a restart the database is cleared. I know that .commit works because I have used it in the past but it is not working now. My assumption is that I am out of scope of the database and I don't have the ability to write. Once again, my code runs and provides no errors, but it will not actually write to the database.</p>
  
  <p>My Connection and Init Code:</p>
  
  <pre><code>def connect_db():
      conn = sqlite3.connect(app.config['DATABASE'])
      conn.row_factory = sqlite3.Row
      return conn
  
  
  def init_db():
      conn = connect_db()
      cursor = conn.cursor()
      sql = 'create table if not exists users (id integer primary key autoincrement, username text not null, password text not null, admin boolean not null)'
      cursor.execute(sql)
      conn.commit()
  </code></pre>
  
  <p>So this code connects to the database and gets everything setup.</p>
  
  <p>Here is a small portion of my code to add an item to the database. It works and it will add items to the "database" but the file size of the database does not increase and if I restart it wont see the new items. But as long as the application is open I have access to the items.</p>
  
  <pre><code>@app.route('/user/', methods=['GET', 'POST'])
  def users():
      conn = connect_db()
      cursor = conn.cursor()
      isAdmin = False
      if (request.form.get('adminuser') != None):
          isAdmin = True
      cursor.execute('insert into users (username, password, admin) values (?, ?, ?)',
                   [request.form['username'], request.form['password'], isAdmin])
      conn.commit()
      return redirect(url_for('index'))
  </code></pre>
  
  <p>Edit I left This Out</p>
  
  <pre><code>DATABASE = '/tmp/database.db'
  </code></pre>
  
  <p>Edit A Crazy Simple Mistake.</p>
  
  <p>Change</p>
  
  <pre><code>DATABASE = '/tmp/database.db'
  </code></pre>
  
  <p>To</p>
  
  <pre><code>DATABASE = './tmp/database.db' 
  </code></pre>