Reputation: 644
I use flask to push html to web, and use bs4 in html.
When I use bs4, modal
, I find if the html passthrough flask, modal
not working at all. I can only use CDN. Below only first one works well.
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js</script>
<script src="../static/bootstrap/js/bootstrap.min.js"></script>
<script src="{{ url_for('static', filename='bootstrap/js/bootstrap.min.js')}}"></script>
As well as bs4.css.
Any sugguestion?
Upvotes: 2
Views: 887
Reputation: 1510
You have to create a folder named 'static' in the same folder than your Flask server script. The 'static' folder contains the bootstrap folder. The line <script src="{{ url_for('static', filename='bootstrap/js/bootstrap.min.js')}}"></script>
will then work.
Upvotes: 2