未在Flask应用中应用CSS [英] CSS not being applied in Flask app

查看:26
本文介绍了未在Flask应用中应用CSS的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用flask和Jinja模板.除了从外部主机下载的引导程序外,没有应用我的CSS.

I am using flask and Jinja templates. None of my CSS is being applied, except for bootstrap which is being downloaded from an external host.

这是我自己的样式表的基础模板中的行:

Here is the line in my base template for my own stylesheet:

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

然后在chrome中打开页面时,我可以点击链接,它成功打开了文件.但是,当我查看框架时,在样式表部分下看不到我的样式表:

And then when I open the page in chrome I can follow the link, and it opens up the file successfully. However when I look in the frames I cannot see my stylesheet under the stylesheets section:

这是来自服务器的请求: GET/static/style/stylesheet.css HTTP/1.1"200-

Here is the request from the server: GET /static/style/stylesheet.css HTTP/1.1" 200 -

看起来好像它没有被识别为CSS文件?我对网络内容不太满意,因此希望这很简单.

It looks likes it's not being recognized as a css file ? I'm not great with web stuff so hopefully this is something simple.

推荐答案

我不知道这里发生了什么.这个问题已经持续了好几天.

I have no idea what was happening here. This issue has been ongoing for days.

要解决此问题,我只复制了加载CSS的行,保存了我的项目,将其粘贴回去,然后运行服务器.群众混乱.

To fix it I simply copied the line that loads the CSS, saved my project, pasted it back in, and ran the server. Mass confusion.

这篇关于未在Flask应用中应用CSS的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆