Skip to content
Permalink
main
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
from flask import Flask
import sqlite3
from flask import flash, session, render_template, request, redirect, url_for
from werkzeug.security import generate_password_hash, check_password_hash
app = Flask(__name__)
app.secret_key = "secret key"
@app.route('/')
def events():
try:
con = sqlite3.connect('events.db')
cur = con.cursor();
cur.execute("SELECT * FROM events")
rows = cur.fetchall()
return render_template('events.html', events=rows)
except Exception as e:
print(e)
finally:
cur.close()
con.close()
@app.route('/empty')
def empty_cart():
try:
session.clear()
return redirect(url_for('.events'))
except Exception as e:
print(e)
if __name__ == "__main__":
app.run()