use a css stylesheet on a jinja2 template

后端 未结 5 749
盖世英雄少女心
盖世英雄少女心 2020-12-28 13:01

I am making a website using html, css, flask and jinja2.

I have a page working on a flask server, the buttons and labels etc. are displayed, but the css stylesheet I

5条回答
  •  盖世英雄少女心
    2020-12-28 13:42

    Tried almost every solution on Stack Overflow. It only worked for me when I placed the static folder in the same directory as my run.py file. I changed my folder structure from:

    app/
        views
        static
        templates
    run.py
    

    To:

    app/
        views
        templates
    static
    run.py
    

    I guess moving the run.py instead would work too. Have a look at this Jinja Templating Tutorial for extra info. Not sure why I had to change the structure for it to work though.

提交回复
热议问题