use a css stylesheet on a jinja2 template

All public files (the ones that are not processed, like templates or python files) should be placed into dedicated static folders. By default, Jinja2 has one static folder called static.

This should fix your problem:

  1. Move /templates/styles.css to /static/styles.css

  2. Update your code with following code, that will be translated into correct file location:

    <link rel="stylesheet" href="https://stackoverflow.com/questions/25034812/{{ url_for("static', filename="https://stackoverflow.com/questions/25034812/styles.css") }}">
    

More info on static files in Jinja2 is here.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)