-
Notifications
You must be signed in to change notification settings - Fork 5
/
app.py
executable file
·40 lines (28 loc) · 851 Bytes
/
app.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
from sqlite3 import Cursor
from flask import Flask, render_template, request, Blueprint
from framework.Database import Database
#Custom..
from framework.Router import Router
import config
#Start the app..
app = Flask(__name__, template_folder=config.VIEWS_DIR)
#Confing start...
app.config.from_object(config)
#---------------------[ Database ]---------------------
app.config["MYSQL_USER"] = "root"
app.config["MYSQL_PASSWORD"] = "----"
app.config["MYSQL_DB"] = "book_store"
app.config["MYSQL_HOST"] = "localhost"
#Database connection
Database = Database(app)
@app.route("/")
def index():
cur = Database.mysql.connection.cursor()
cur.execute("select * from books")
data = cur.fetchall()
Database.mysql.connection.commit()
return str(data)
Router.run(app)
if __name__ == '__main__':
app.debug = True
app.run()