In your flask: app = Flask(__name__, static_url_path="/static")
You are using static, and by default, he uses static directory by default. So, if your CSS is not inside a folder called “static” he’s not gonna find the file.
Also, it’s better if you use Flask’s built-in render_template function to render your HTML.
Create a folder called “templates” and put your home.html inside that folder.
Than, your main.py would be something like this:
from flask import Flask, render_template
app = Flask(__name__)
@app.route("/")
def home():
return render_template('home.html')
if __name__ == "__main__":
app.run(host='0.0.0.0', port=81)
And the files in your project would be something like:
Keep the file structure as @WindLother suggested, then change a html line from; <link href="style.css" rel="stylesheet" type="text/css"/>
To <link href="/static/style.css" rel="stylesheet" type="text/css"/>
You had to provide the actual path of the file. Not just the file name