from flask import Flask from flask import render_template app = Flask(__name__, template_folder='templates') @app.route("/viewdata/") def index1(): return render_template('View-Data.html', id=1) @app.route("/viewdata/<int:id>") def index(id): return render_template('View-Data.html', id=id) @app.errorhandler(404) def page_not_found(e): return render_template('404.html'), 404
<!DOCTYPE html>
<html>
<head>
<title>Data</title>
</head>
<body>
<h1>You have entered {{ id }}</h1>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<title>Data</title>
</head>
<body>
<h1>Error in the Data</h1>
</body>
</html>