20 lines
398 B
Python
20 lines
398 B
Python
# Searches for shows
|
|
|
|
from cs50 import SQL
|
|
from flask import Flask, render_template, request
|
|
|
|
app = Flask(__name__)
|
|
|
|
db = SQL("sqlite:///shows.db")
|
|
|
|
|
|
@app.route("/")
|
|
def index():
|
|
return render_template("index.html")
|
|
|
|
|
|
@app.route("/search")
|
|
def search():
|
|
shows = db.execute("SELECT * FROM shows WHERE title = ?", request.args.get("q"))
|
|
return render_template("search.html", shows=shows)
|