Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from flask import Flask, render_template
- app = Flask(__name__)
- @app.route('/')
- def home():
- return 'Welcome to the Flask App with Dynamic Content!'
- @app.route('/user/<username>')
- def display_user(username):
- return f'Hello, {username}!'
- if __name__ == '__main__':
- app.run(debug=True)
- ##### index.html #####
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="UTF-8">
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
- <title>Dynamic Greeting</title>
- </head>
- <body>
- <h1>Hello, {{ username }}!</h1>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement