-1

I have a Flask site running on a raspberry pi, and I implemented some bootstrap stuff to make it look better. However, the pi is running an access point, so it cant connect to the internet to include the bootstrap files. So, I downloaded the Bootstrap files and placed it into the folder with the python script, and the flask templates folder. NOT INSIDE the templates folder, since I see thats a common mistake. When I open the html file raw in a browser, it displays perfectly, using bootstrap, but when I start the flask site and test it again, it displays the site as if the bootstrap files doesn't exist! How can this be?

davidism
  • 110,080
  • 24
  • 357
  • 317

2 Answers2

1

With the default Flask configuration, you will need to place static files in the static directory within your project and refer to them via /static/....

AKX
  • 123,782
  • 12
  • 99
  • 138
1

You will need to create a static folder in your application which will hold all your styling needs.

Within that folder, add your bootstrap files. In your templates, properly create a link to the bootstrap files:

$ <link rel="stylesheet" type="text/css" href="{{ url_for('static', filename = '<your-bootstrap-file>') }}">
Gitau Harrison
  • 2,464
  • 1
  • 15
  • 20