from flask import Flask 

import sqlite3

conn = sqlite3.connect('database.db')
print("Opened database successfully")

try:
    conn.execute('CREATE TABLE students (name TEXT, addr TEXT, city TEXT, pin TEXT)')
    print("Table created successfully")
except:
    print("Table already exists")

conn.close()
import views
app = Flask(__name__)

# url
app.add_url_rule('/','index',views.index)
app.add_url_rule('/addrec','addrec',views.addrec,methods = ['POST', 'GET'])
app.add_url_rule('/list','list',views.list)

# run the app
if __name__ == "__main__":
    app.run(debug=True)