main.py
from flask import Flask, render_template
# Create a flask app
app = Flask(
__name__,
template_folder='templates',
static_folder='static'
)
# Index page
@app.route('/')
def index():
return render_template('index.html')
if __name__ == '__main__':
# Run the Flask app
app.run(
host='0.0.0.0',
debug=True,
port=8080
)
index.html
<!doctype html>
<head>
<title>My First Flask Website</title>
<link href="/static/style.css" rel="stylesheet" type="text/css">
</head>
<body>
<h1>Hello, World!</h1>
<p>
Welcome to your first Flask website
</p>
</body>
</html>
style.css
p {
color: red;
}
h1{
text-align:center;
}