So I want to include some js and css files in my html page that flask serves but want them in /js/ and /cs/ instead of all in /static/ grouped together.
I tried to do this More than one static path in local Flask instance
using:
(part of the randomly named cat.html)
<link rel="stylesheet" href="{{url_for('css_static',filename='bootstrap.min.css')}}">
<link rel="stylesheet" href="/static/css/bootstrap-responsive.min.css">
<link rel="stylesheet" href="/css/style.css">
<link rel="stylesheet" href="/css/prettify.css">
and
(part of app.py)
@app.route('/sigma')
def sig():
return render_template('cat.html')
@app.route('/css/<path:fn>')
def css_static(fn):
return send_from_directory('/css/',fn)
@app.route('/js/<path:fn>')
def js_static(fn):
return send_from_directory(app.config['JS_STATIC'],fn)
when I try this it doesn't work (the /cat.html
) shows Internal Server Error.
and when I go to /css/bootstrap-responsive.min.css
it loads forever....
so what am I doing wrong?
Edit: it seems the only directory open is /static/...
which I don't know why since I have a /js/
route.