'Custom css is not rendered correctly in flask
I have updated the base url of the flask application.
app.py
app = Flask(__name__)
@app.route(f'{root}' + '/')
def index():
........
.......
return render_template('index.html')
Application directory structure:
/app
/static
/style.css
/template
/index.html
app.py
I have placed my custom style.css file under static folder. When i ran the application under console in developer tools there is an error which is not allowing to render the style.css
error: https://domain/static/style.css
The actual url has to point https://domain/f'{root}'/static/style.css
the code in index.html:
To access style.css
<link rel="stylesheet" href="{{url_for('static', filename='style.css')}}">
Question
How to redirect the style.css url as mentioned above https://domain/f'{root}'/static/style.css without modifying the style.css directory path ?
Help would be appreciated, Thanks
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
