Answer the question
In order to leave comments, you need to log in
How to write a static file in Django?
Something I can’t figure out how to link a static file to a project in Django. In different places, this process is described in different ways, which makes you even more confused :(
I did this: in settings.py I wrote STATIC_URL = '/static/' and in INSTALLED_APPS 'django.contrib.staticfiles', (more precisely, he was registered there). By the way, one more question follows from this: is it necessary
to
register STATICFILES_DIRS and why and what to write there? I
created a static folder in it js and put the file itself in it:
... For example, at the moment it is written like this: {% load staticfiles %}
<img src="{% static "mysite/js/Chart.js" %}" alt="My js"/>
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question