views routes all have / at start

master
Castro0o 4 years ago
parent d23e4857af
commit 91508a6d73

@ -15,9 +15,14 @@ app.secret_key = 'PiracyIsCool'
now = datetime.datetime.now() now = datetime.datetime.now()
@app.route("test")
@app.route('/test', methods=['GET'])
def test(): def test():
return redirect('.'+url_for('index')) index = url_for('index')
about = url_for('about')
links = f"<a href='{index}'>index</a><br/><a href='{about}'>about</a>"
return links
@app.route('/', methods=['GET']) @app.route('/', methods=['GET'])
def index(): def index():
@ -71,7 +76,7 @@ def bookrequest():
return render_template('public/upload_book.html', books=books) return render_template('public/upload_book.html', books=books)
# from POST /submit store data in the database and forward to the request # from POST /submit store data in the database and forward to the request
@app.route('submit', methods=['POST']) @app.route('/submit', methods=['POST'])
def submit(): def submit():
book = dict(title=request.form['title'], author=request.form['author'], publisher=request.form['publisher'], year=request.form['year'], extention=request.form['extention']) book = dict(title=request.form['title'], author=request.form['author'], publisher=request.form['publisher'], year=request.form['year'], extention=request.form['extention'])
table.insert(book) table.insert(book)

Loading…
Cancel
Save