示例#1
0
 def __init__(self):
     """
     Initializes database connection and sessionmaker
     """
     engine = db_connect()
     create_deals_table(engine)
     self.Session = sessionmaker(bind=engine)
示例#2
0
 def __init__(self):
     """
     Initializes database connection and sessionmaker.
     Creates deals table.
     """
     engine = db_connect()
     create_deals_table(engine)
     self.Session = sessionmaker(bind=engine)
示例#3
0
 def __init__(self):
     engine = db_connect()
     create_houses_table(engine)
     self.Session = sessionmaker(bind=engine)
示例#4
0
from sqlalchemy.orm import sessionmaker
from flask import Flask, render_template
from scraper_app.models import Template, db_connect
from scraper_app.settings import DATABASE

app = Flask(__name__)
app.secret_key = 'dev'
app.config['SQLALCHEMY_DATABASE_URI'] = DATABASE

engine = db_connect()
Session = sessionmaker(bind=engine)
session = Session()


@app.route('/')
def index():
    templates = session.query(Template).all()
    return render_template('data.html', templates=templates)


if __name__ == "__main__":
    app.run(host='0.0.0.0', port=7778, debug=True)