my django getting 404 error when trying jquery-2.2.4.js
file. however, getting css/boardcss.css
file fine, though both in same top-level /static/ folder, after doing collectstatic. help?
here jquery 404 error when run site:
django version 1.9.6, using settings 'tictactoe.settings' starting development server @ http://127.0.0.1:8000/ quit server ctrl-break. [06/jun/2016 23:04:21] "get /board/ http/1.1" 200 361 [06/jun/2016 23:04:21] "get /static/jquery-2.2.4.js http/1.1" 404 1658 [06/jun/2016 23:04:21] "get /static/css/boardcss.css http/1.1" 304 0
my html file:
{% load staticfiles %} <!doctype html> <html lang="en"> <head> <script type="text/javascript" src="{% static 'jquery-2.2.4.js' %}"> </script> <link rel="stylesheet" href="{% static 'css/boardcss.css' %}"> </head> <body class="body" style="background-color:#545454"> <div class='container-fluid'> {% block content %} {% endblock %} </div> </body> </html>
from settings.py file:
static_url = '/static/' staticfiles_dirs = [ os.path.join(base_dir, "board", "static"), ] static_root = os.path.join(base_dir, "static")
my directory tree:
ok, have 2 static folders. believe problem. note when go 1 level , static, in 1 of them have jquery file , other don't.
you might need configure:
https://docs.djangoproject.com/en/1.9/ref/settings/#std:setting-staticfiles_finders
[ 'django.contrib.staticfiles.finders.filesystemfinder', 'django.contrib.staticfiles.finders.appdirectoriesfinder', ]
the list of finder backends know how find static files in various locations.