Comment ajouter CSS dans l'application Flask
<link rel= "stylesheet" type= "text/css" href= "{{ url_for('static',filename='styles/mainpage.css') }}">
Smoggy Sloth
<link rel= "stylesheet" type= "text/css" href= "{{ url_for('static',filename='styles/mainpage.css') }}">
<link rel="stylesheet" href="{{ url_for('static', filename='css/main.css') }}">
{% block styles %}
{{super()}}
<link rel="stylesheet"
href="{{url_for('.static', filename='mystyle.css')}}">
{% endblock %}
#link it in html
<link rel= "stylesheet" type= "text/css" href= "{{url_for('static', filename='styles/styles.css') }}">
#place a config for your app so that browser doesn't store cashe, if this doesn't update your css clear browser cash for last {x} hours
if __name__ == '__main__':
app.config['SEND_FILE_MAX_AGE_DEFAULT'] = 1
app.run()
#make sure that your directory looks something like this...
|root|
MainFileWithFlaskProgram.py
|static|
|styles|
styles.css
|templates|
YourHTMLFile.html