Elroum
Elroum

Reputation: 327

Django : static files are not loaded

i'm trying to test the code mentionned in this page : dynamic-formset.js and i added :

<script src="{% static  'js/dynamic-formset.js' %}"></script>
<script src="{% static  'js/jquery-3.3.1.js' %}"></script>

in order to load static files that contains js. howerver the js doesn't work and i'm getting in the console the following lines :

 "GET /static/js/dynamic-formset.js HTTP/1.1" 404 1777
 "GET /static/js/jquery-3.3.1.js HTTP/1.1" 404 1768

when i replace the second ligne that imports jquery with the https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js , i dont get :

"GET /static/js/jquery-3.3.1.js HTTP/1.1" 404 1768

i only get "GET /static/js/dynamic-formset.js HTTP/1.1" 404 1777

do you have any idea why it doesn't work ? i guess that the static files are not loading. Any help please ? Thank You

Upvotes: 0

Views: 932

Answers (1)

Ochui Princewill
Ochui Princewill

Reputation: 157

If you are using django 2.x.x make sure your static files are in a sub folder inside the static folder that corresponds to your app name. See Other question

Upvotes: 1

Related Questions