Created
March 1, 2013 02:46
-
-
Save lucidguppy/5062112 to your computer and use it in GitHub Desktop.
Access a sqlalchemy database through importing it.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from flask import Flask | |
from flask import render_template | |
from random import randrange | |
#create the app object | |
app = Flask(__name__) | |
#get the database | |
import tables as t | |
..blah blah blah... | |
@app.route("/add_reading") | |
def add_data(): | |
data = {'temperature': randrange(-40,140)} | |
stmt = t.temperature_table.insert() | |
res = stmt.execute(data) | |
return render_template('added_temp.html', results=res) | |
...blah blah blah... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment