1

I'm having trouble importing files to netbeans(IDE) with flask. So far, I have downloaded the bootstrap files and placed them in a folder called "static" (that I created), in the folder where my flask scripts and libraries are kept. On my html page I wrote :. And yes "url_for" was imported.

How can I make this work? For this case and future cases where I need to load different css files. Thanks in advance.

1 Answer 1

2

For importing and using bootstrap you should add them to your static folder, i.e.:

<html> <head> <link rel="stylesheet" href="{{url_for('static', filename='bootstrap.min.css')}}"> </head> <body> </body> </html> 

Please pay attention, that value in fieldname should points to Bootsrap's exact name and should include relative path from your static folder.

Sign up to request clarification or add additional context in comments.

4 Comments

Does it matter where my static folder is placed?How does my environment even know where the "static" folder is?
Default your static folder is placed in the same folder where you put your running script. And Flask will search it there.
Ok thanks, I got it working now. I have to create one for every project right? I don't think there's a default one
@GlebPobudzey Exactly. For each project, and if you use Blueprints - than inside each blueprint folder.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.