Im trying to get rid of 404
with Django local server.
My page includes this:
<script type="text/javascript" src="{{ STATIC_URL }}js/myjscript.js"></script>
Actual file lies in C:/Users/PyCharmProjects/MyProject/MyApp/static/js/myjscript.js
Django docs says:
Put your static files somewhere that staticfiles will find them.
By default, this means within static/ subdirectories of apps in your INSTALLED_APPS.
I believe my setup fit to defaults, but I still getting 404
, why so?
Kindly help!
UPDATE
Solved this with simply using template tag approach:
{% load static %}
<script type="text/javascript" src="{% static 'js/myjscript.js' %}"></script>
In the docs they saying about configuring STATICFILES_STORAGE
, but I didnt even touch it, and get 200
for these files now.
This place of Django - static files - seems pretty dark and unclear for me. I cant understand purpose of such many sophisticated solutions for such simple task.
If somebody will point to good not-obscure manual for all this, I will highly appreciate!