我在Flask应用程序中设置了一个蓝图,但我似乎无法使我的静态文件夹工作.我试图联系到他时遇到404错误:
127.0.0.1 - - [11/Sep/2014 15:14:20] "GET /static/js/bootstrap.min.js HTTP/1.1" 404 - 127.0.0.1 - - [11/Sep/2014 15:14:20] "GET /static/static/css/bootstrap.min.css HTTP/1.1" 404 -
css one也附加静态两次.JS具有正确/静态但似乎不起作用.现在,我的静态文件夹位于蓝图根路径(app/dashboard
)中.我试过把它插入app/static
但我得到了同样的错误.
我有以下设置:
app/dashboard/__init__.py
:
from flask import Blueprint dashboard = Blueprint('dashboard', __name__, template_folder='templates', static_folder='static') from application.dashboard import controllers
app/__init__.py
:
# Blueprints from flask import Blueprint from application.dashboard import dashboard app.register_blueprint(dashboard)
在app/templates/layout.html
,我有一行引用两个静态文件,如下所示:
我的app/dashboard/static
目录:
$ tree application/dashboard/static/ application/dashboard/static/ ??? css ? ??? bootstrap-theme.css ? ??? bootstrap-theme.css.map ? ??? bootstrap-theme.min.css ? ??? bootstrap.css ? ??? bootstrap.css.map ? ??? bootstrap.min.css ??? fonts ? ??? glyphicons-halflings-regular.eot ? ??? glyphicons-halflings-regular.svg ? ??? glyphicons-halflings-regular.ttf ? ??? glyphicons-halflings-regular.woff ??? js ??? bootstrap.js ??? bootstrap.min.js
知道这里发生了什么吗?如何正确构建我的蓝图?我按照Flask文档中的说明操作,我收到此错误.
谢谢.