Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

282
Views
Why doesn't my html file get my javascript file. load static

here is my settings.py:

    STATIC_DIR = os.path.join(BASE_DIR,'static')
    STATIC_URL = '/static/'
    STATICFILES_DIR = [STATIC_DIR]

here is the end of my html page:

   {% load static %}
       <script src="{% static '/js/script.js' %}" type="text/javascript"></script>
   </html>
   {% endblock %}

I have a folder static and inside it, there are two more folders one is js and the other is css. But when I try to load it, it always says "GET /static/js/script.js HTTP/1.1" 404 1795 I have tried many things but it does not work. Someone please help.

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

If it is development server (i.e DEBUG = True), then try this:

STATIC_URL = '/static/'
STATICFILES_DIRS = (
    'static',
)
STATIC_ROOT = os.path.join(BASE_DIR, 'staticfiles')

If it is production server, then you simply remove the STATICFILES_DIR. The official documentation explains this more in depth.

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!