Flask静态文件获取404

我正在使用以下项目结构构建一个基本的Web应用程序。该应用程序很好,但是某些静态文件出现了404错误。

我没有任何这样的文件bootstrap.css.map,并且在flask中找不到与此相关的足够文档。

127.0.0.1 - - [09/Feb/2014 22:37:17] "GET /static/css/bootstrap.css.map HTTP/1.1" 404 -

@app.route('/')
def index():
print 'in /'
return send_file('templates/login.html')

目录结构:

app/
├── static/
│   └── bootstrap.min.css
├── templates/
│   └── index.html
└── app.py

编辑:这是我的登录html

<!DOCTYPE html>
<html lang="en">

<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="">
<meta name="author" content="">

<title>API Test Application</title>

<!-- Bootstrap core CSS -->
<link href="/static/css/bootstrap.min.css" rel="stylesheet">

<!-- Custom CSS for the 'Thumbnail Gallery' Template -->
<link href="/static/css/2-col-portfolio.css" rel="stylesheet">
</head>

<body>
 ......simple login form..........
</body>
</html>
位图

_static_folder针对Flask设置位置

app = Flask(__name__)
app._static_folder = <path to to your static directory>

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章