Etchosh
Etchosh

Reputation: 109

Javascript not reflected on Django Project

I am trying to show a carousel box/ banner in my page but I am having an issue with the JavaScript it is not appearing. I have borrowed the HTML/ CSS and JS from https://codepen.io/StephenScaff/pen/egOedp/ and I am trying to apply the same concept to my Django Project.

I have added the HTML in a file called projects.html and in the base file I have linked a new CSS file simple.css with css format which in my Django project project working but my issue is when I tried to implement to JS file here is what happened in my trials.

Also the next and previous buttons are not showing

Trial 1 I have added under the HTML file projects.html but the js code appeared under the banner image like normal text

{% block script %}
Added the JS code...
{% endblock script %}

Trial 2 in my base.html file I created a new file called simple.js and added in the static folder and linked it but still it didn't reflect on the server.

    <script src="{% static 'simple.js' %}"></script>

My question What am I doing wrong causing this confusion and how to implement the JS code for this simple banner to my project.

Upvotes: 0

Views: 137

Answers (2)

Fady Bark
Fady Bark

Reputation: 105

First of all, run python manage.py collectstatic and make sure your static files are in the correct directory (manage.py will tell you how many files it copied or changed), second of all use shift + F5 to reload the browser without cached content (or as I like to call it, really reload).

Upvotes: 1

Kiran
Kiran

Reputation: 579

you have fired this command after static files replace?

python manage.py collectstatic

Upvotes: 1

Related Questions