是这样的。。。
这是我在base/post.html文件中写的:
<link href="{{ url_for('static',filename='css/bootstrap.min.css') }}" rel="stylesheet">
这是注册的蓝图:
mod = Blueprint("base",name)
@mod.route("/ogin")
def login():
return render_template("base/post.html")
这是请求:
http://127.0.0.1/ogin
这是返回的资源:
<link href="/ogin/static/css/style.css" rel="stylesheet">
问题是:
为什么返回的资源会有ogin前缀?我用nginx跑的,配置如下:
location / {
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME "";
fastcgi_param PATH_INFO $fastcgi_script_name;
fastcgi_pass unix:/tmp/o.sock;
}
location ~ ^/(static/){
root /root_path/app;
access_log off;
expires max;
}