I want to call a HttpResponse from a view in my main.js file, but I'm getting this error in the console //localhost:8000/%7B%%20url%20'join_dpt'%20%%7D 404 (Not Found), everything was fine when I had all in a same index.html file but now I don't want to have the scrips in the index.html so I moved it to a main.js file.
This is how I'm calling the HttpResponse (I was doing the same in the index.html file and it was fine)
d3.json("{% url 'join_dpt' %}")
this is how my folders order:
-- django
-- env
-- app
-- project
-- urls.py
-- static
-- css
-- js
-- main.js
-- templates
-- index.html
and I have this in my settings.py
STATIC_URL = '/static/'
#new
STATICFILES_DIRS =(
os.path.join(BASE_DIR,'static'),
)
any ideas on how can I solve this?