Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from flask import Flask, render_template, request
- from flask.ext.sqlalchemy import SQLAlchemy
- #from sqlalchemy import text
- from sqlalchemy import create_engine
- app = Flask(__name__)
- app.config['SQLALCHEMY_DATABASE_URI'] = 'postgresql://postgres:odoo@localhost/odoo'
- db = SQLAlchemy(app)
- engine = create_engine(
- "postgresql://postgres:odoo@localhost/odoo",
- isolation_level="READ UNCOMMITTED"
- )
- @app.route("/")
- def index():
- result = engine.execute("select * from product_template")
- names=[]
- for row in result:
- names.append(row)
- return render_template('index.html',result=names)
- @app.route("/hello")
- def hello():
- return render_template('index.html')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement