Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import sqlite3
- from flask import Flask
- from jinja2 import Template
- app = Flask(__name__)
- @app.route('/resistance')
- def What_the_fuck_am_I_doing():
- con=sqlite3.connect("local_store\\test.db")
- con.isolation_level= None
- cur=con.cursor()
- cur.execute("select * from resistance")
- #resistance is an sql table with two fields, an ID and a name
- allnames=cur.fetchall()
- print (allnames)
- t = Template("<HTML><table><CAPTION>Fighters</CAPTION><TR> <TH>Number</TH><TH>Name</TH></TR> {%for item in items%} <TR> <TD> {{item[0]}} </TD> <TD>{{item[1]}} </TD> <TR> {% endfor %} </HTML>" )
- cur.close()
- print (t.render(items=allnames))
- return t.render(items=allnames)
- @app.route('/')
- def hello_world():
- return ("<HTML>OH HAI!</HTML>")
- if __name__ == '__main__':
- app.run(debug = True)
Advertisement
Add Comment
Please, Sign In to add comment