Exemplo n.º 1
0
from sqlalchemy.sql import text

app = Flask(__name__)

photos = UploadSet('photos', IMAGES)

app.config.from_object(
    'config'
)  # link config.py to this file(with all databse file paths, image upload paths)

configure_uploads(app, photos)

db = SQLAlchemy(app)
bootstrap = Bootstrap(app)
em_cart = ShoppingCart()
em_cart.total = 0


@app.route('/')
def home():
    items = Retailer.query.all()
    w_items = Wholeseller.query.all()
    govt = Government.query.all()
    retailer_list = ['kiran', 'raju', 'mani', 'jayanthi', 'naresh']
    best_retailer = random.choice(retailer_list)
    connection = engine.connect()
    s = text("SELECT SUM(price) FROM Retailer WHERE region=:r")
    total_revenue = 450
    return render_template('pages/index.html',
                           items=items,
                           govt=govt,