I do not load styles when starting a server in flask

0

I do not load the css styles of my page when I start it with flask, but I open the file on my own if I upload them.

This is my flask code:

from flask import Flask
from flask import render_template

app = Flask(__name__)

@app.route('/')
def index():
    return render_template('index.html')

@app.route('/microfonos_para_cantar')
def microfonos_para_cantar():
    return render_template('microfonosCanto.html')

if __name__ == '__main__':
    app.run()
    
asked by Pablo Cortes Rodriguez 07.11.2017 в 21:38
source

1 answer

0

What you should do is that in the attribute href of your label link uses url_for , for example:

<link href="{{ url_for('static',filename='styles/mi_estilo.css') }}" rel="stylesheet" type="text/css">

What I'm trying to say with this is that my styles are in: /static/styles/my_style.css

    
answered by 25.12.2017 в 00:09