0% found this document useful (0 votes)
2 views3 pages

2

The document contains a simple Flask web application with two routes: a home page and an about page. It includes HTML templates for both pages and a CSS file for styling. The application is set to run in debug mode for development purposes.

Uploaded by

sayinikarthik54
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views3 pages

2

The document contains a simple Flask web application with two routes: a home page and an about page. It includes HTML templates for both pages and a CSS file for styling. The application is set to run in debug mode for development purposes.

Uploaded by

sayinikarthik54
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

Code:

main.py:
from flask import Flask, render_template
app = Flask(__name__)
@app.route('/')
def home():
return render_template('home.html')
@app.route('/about')
def about():
return render_template('about.html')
if __name__ == '__main__':
app.run(debug=True)

statics:
style.css:
/* static/style.css */
body {
background-color: #f2f2f2;
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
color: #333;
text-align: center;
padding: 50px;
}
h1 {
color: #2c3e50;
}
p{
font-size: 18px;
margin-top: 10px;
}
a{
display: inline-block;
margin-top: 20px;
text-decoration: none;
color: #fff;
background-color: #3498db;
padding: 10px 20px;
border-radius: 5px;
transition: background-color 0.3s ease;
}
a:hover {
background-color: #2980b9;
}

Templates:
home.html:
<!DOCTYPE html>
<html>
<head>
<title>Home Page</title>
<link rel="stylesheet" type="text/css" href="{{ url_for('static', filename='style.css') }}">
</head>
<body>
<h1>Welcome to the Home Page!</h1>
<p>This is the main page of the Flask app.</p>
<a href="/about">Go to About Page</a>
</body>
</html>

about.html:
<!DOCTYPE html>
<html>
<head>
<title>About Page</title>
<link rel="stylesheet" type="text/css" href="{{ url_for('static', filename='style.css') }}">
</head>
<body>
<h1>About This Application</h1>
<p>This Flask web app was created using HTML templates.</p>
<a href="/">Back to Home</a>
</body>
</html>

Output:

You might also like