Flask Not Finding Files In My Package's 'static' Directory
My question is similar to several others on this site, but the answers I find there aren't working for me. I'm learning Flask. I'm running Flask 0.10.1 and Python 2.7, on an Ubuntu
Solution 1:
You aren't telling Flask that the files are in your static folder. The easiest way to do that is with url_for
.
<link rel="stylesheet" href="{{ url_for('static', filename='styles.css') }}">
Solution 2:
You could use url_for to serve the static files. An example can be found here.
PS: Unless you are making something really large, serving them by using '/static/file.css' should work fine. In production environments it's better to get Apache or nginx to serve static files.
Post a Comment for "Flask Not Finding Files In My Package's 'static' Directory"