search

Home  >  Q&A  >  body text

python - flask将引用外部css的link的问题

报错:
GET http://127.0.0.1:5000/css/bootstrap.min.css 404 (NOT FOUND)

我的link写法
<link href="css/bootstrap.min.css" rel="stylesheet">
没有开服务器的时候页面是正常显示的,开了服务器它就在链接前面添加了http://127.0.0.1:5000/ 导致找不到

PHP中文网PHP中文网2887 days ago329

reply all(1)I'll reply

  • ringa_lee

    ringa_lee2017-04-17 17:38:08

    There is something wrong with the problem description. I don’t understand why the page displays normally when the server is not turned on.

    In addition, is your static resource path correct? For <link href="css/bootstrap.min.css" rel="stylesheet">这种链接,
    自然是会映射到http://127.0.0.1:5000/css/bootstrap.min.css, if it is external css, you can use the complete url to reference it

    reply
    0
  • Cancelreply