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?
            Asked
            
        
        
            Active
            
        
            Viewed 384 times
        
    2 Answers
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
- 
                    Do I just put the whole bootstrap folder in another folder named "static"? – Wilmer Kluever Mar 22 '21 at 08:57
- 
                    That should work. You will just need to also change the references in your templates - see the link! – AKX Mar 22 '21 at 08:58
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
 
    