From c355c31f72b5658f1d3b37c60c137a8275e964ca Mon Sep 17 00:00:00 2001 From: Marius Peter Date: Sun, 24 Jul 2022 16:04:36 +0200 Subject: Main app. --- app/main.py | 24 ++++-------------------- 1 file changed, 4 insertions(+), 20 deletions(-) diff --git a/app/main.py b/app/main.py index 149ef64..fd1a8a0 100644 --- a/app/main.py +++ b/app/main.py @@ -1,22 +1,6 @@ # -*- mode: python; -*- """ -routes.py module ----------------- - -This Python module contains the logic supporting: -1. Navigating between website pages -2. Interpreting user requests to the server -3. Dispatching requested content back to the user - -Python dependencies: -- flask: provides web application features -- forms: provides secure user form submission -- sqlalchemy: provides communication with database on server. - -Personal imports: -These are used to avoid cluttering this file with -placeholder data for posts' content. """ import os @@ -104,9 +88,9 @@ def download_remote(): db.session.add(new_download) db.session.commit() flash(f"Successfully started downloading {title}.") - return redirect("/index") + return redirect(url_for("main.home")) flash(f"Couldn't download {title}.") - return redirect("/index") + return redirect(url_for("main.home")) @main.route("/manage-remote/", methods=["POST"]) @@ -126,7 +110,7 @@ def manage_remote(): elif form.remove_remote.data: return redirect(url_for("main.remove_remote", file=file_name)) flash("Couldn't manage remote file.", "error") - return redirect("/index") + return redirect(url_for("main.home")) @main.route("/download-local/", methods=["GET", "POST"]) @@ -144,4 +128,4 @@ def remove_remote(file): file_to_remove = os.path.join(os.getcwd(), "downloads", file) os.remove(file_to_remove) flash(f"Successfully removed file {file}.") - return redirect("/index") + return redirect(url_for("main.home")) -- cgit v1.2.3