vandelay
vandelay

Reputation: 2075

Static files with bootstraps directory

I thought it would be easier to download bootstrap and adjust it to my code, instead of messing about a cdn. So I downloaded bootstrap and my directory looks like this.

enter image description here

My static directory is properly (I think) setup since my style.css and maps.js are working fine.

In my base.html I reference the files with:

The old way <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">

<link rel='stylesheet' type='text/css' href="{% static 'style.css' %}" />
<script src="{% static 'maps.js' %}"></script>
<script src="{% static 'bootstrap-3.3.7' %}"></script>

The static boostrap-3.3.7 is not working. The cdn worked however. My question is how would my static import look to have this setup with the bootstrap directory properly work?

I'm sorry if it's a stupid question.

Upvotes: 0

Views: 377

Answers (1)

Nrzonline
Nrzonline

Reputation: 1618

You are trying to include a complete directory into your HTML, which is impossible. You should adjust the path in {% static 'bootstrap-3.3.7' %} to the location of the actual file you need.

<script src="{% static 'bootstrap-3.3.7/dist/js/boostrap.min.js' %}"></script>

Note, don't forget to add the css file too, you need to include them both individually. Which will probably be:

<link rel="stylesheet" type="text/css" href="{% static 'bootstrap-3.3.7/dist/css/boostrap.min.css' %}"/>

Upvotes: 1

Related Questions