Guest User

Untitled

a guest
Oct 2nd, 2018
151
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.40 KB | None | 0 0
  1. from flask import Flask, render_template
  2. import MySQLdb
  3.  
  4. app = Flask(__name__)
  5.  
  6. mariadb_connection = MySQLdb.connect(user='root', password='24611943e', database='bookstore')
  7. cursor = mariadb_connection.cursor()
  8.  
  9.  
  10.  
  11. @app.route('/', methods=['POST', 'GET'])
  12. def main():
  13. cursor.execute("SELECT title, isbn FROM books")
  14. calendar = cursor.fetchall()
  15. return render_template('index.html', calendar=calendar)
Add Comment
Please, Sign In to add comment