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.

Cheen
  • 86
  • 3
  • 12

1 Answers1

5

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

DevHyperCoder
  • 895
  • 1
  • 9
  • 22