From c8f703e7d9f44ccc970469b2eeee74ffae929652 Mon Sep 17 00:00:00 2001 From: GKT01 Date: Mon, 22 Dec 2025 19:42:56 +0300 Subject: [PATCH] Added return,redirect --- hello_app/views.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/hello_app/views.py b/hello_app/views.py index 8f714ea90..5133da085 100644 --- a/hello_app/views.py +++ b/hello_app/views.py @@ -1,5 +1,5 @@ from datetime import datetime -from flask import Flask, render_template +from flask import Flask, redirect, url_for,render_template from . import app @app.route("/") @@ -14,6 +14,15 @@ def about(): def contact(): return render_template("contact.html") + +#To test this function, On the Website you can simply add /url_for/ +#To the end of the URL +@app.route("/url_for/") +def url_for_test_page(): + return redirect(url_for('contact')) +#This will redirect the /url_for/ link to the contact page. + + @app.route("/hello/") @app.route("/hello/") def hello_there(name = None):