0

I did my best to try to use bootstrap locally with flask on a computer (without internet connection). My folders are like that : Templates

-layout.html -bootstrap -css -bootstrap.min.css -js -bootstrap.min.js -jquery-3.2.1.slim.min.js -popper.min.js 

And in my layout.html file, I use bootstrap with these lines :

<link rel="stylesheet" href="bootstrap/css/bootstrap.min.css"> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1" 

in the head tag and

<script src="bootstrap/js/jquery-3.2.1.slim.min.js"></script> <script src="bootstrap/js/popper.min.js"></script> <script src="bootstrap/js/bootstrap.min.js"></script> 

in the body tag. If I launch just this html file, the bootstrap is working but if I use this template in my app.py file like that :

@app.route("/") @app.route("/home/") def home(): return render_template("layout.html") 

The bootstrap isn't working... Thank you in advance for your help.

0

1 Answer 1

6

Store the entire bootstrap folder in a directory named static then use <link rel='stylesheet' href='/static/bootstrap/css/bootstrap.min.css>

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

8 Comments

Unfortunately it's still not working... (I changed its to href='static/bootstrap/css/bootstrap.min.css' and like this it works if I open the layout.html but not with using flask...)
Is your layout.html file in the templates folder
yes it is in the templates folder
Btw the static folder shouldn't be in templates folder
Any idea what to do now if i want to use js as it's not static ? like bootstrap.min.js or popper.min.js...
|

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.