CSS not loading completely when i run my python application
تبليغيرجى شرح بإيجاز لمإذا تشعر أنك ينبغي الإبلاغ عن هذا السؤال.
I intend to apply basic CSS over my HTML under my python/ flask application. I got a HTML with CSS file from getbootstrap.com.
Link: https://getbootstrap.com/docs/5.2/examples/cover/
The HTML loads up completely when I run it locally (outside the project) but it does not load properly when I try running the application using flask on dev (localhost).
Can someone please suggest a fix here. I have tried placing the CSS file in static folder and then loading it with below approach (adding link to CSS file in my HTML):
<link rel=”stylesheet” type=”text/css” href=”{{ url_for(‘static’, filename=’stylesheets/cover.css’) }}”>
My project directory looks like:
env
static > stylesheets > cover.css
templates > index.html
app.py
app.py file:
from flask import Flask, render_template
app = Flask(__name__)
@app.route(‘/’)
def base():
return render_template(‘index.html’)
if __name__ == “__main__”:
app.run(debug=True, port=5000)
By default it comes with the following link:
<link href=”cover.css” rel=”stylesheet”>
After running the project, it looks like as attached under the snap. This means that the CSS is getting applied but not completely.
أضف إجابة