-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
  • 121,510
  • 29
  • 395
  • 339
Wilmer Kluever
  • 109
  • 1
  • 8

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
  • 152,115
  • 15
  • 115
  • 172
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
  • 3,179
  • 1
  • 19
  • 23