[FIXED] Flask static files getting 404

Issue

I am building a basic web app with the following project structure. The app is fine, but I’m getting 404 errors on some static files.

I don’t have a file like this bootstrap.css.map and I can’t find enough documentation related to this in 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 with "/"
return send_file('templates/login.html')
 

Directory structure:

app/
├──Static/
│ └──bootstrap.min.css
├──Template/
│ └── index.html
└── app.py
 

EDIT: Here is my login HTML






API test application


……simple login form…………


Solution

Set _static_folder location against Flask.

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

Answered By – Bitmap

Answer Checked By – David Goodson (Easybugfix Volunteer)

Leave a Reply

(*) Required, Your email will not be published