Django temlpate problem | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Django temlpate problem

i use a template im my django homepage.(http://127.0.0.1:8000/) I linked statics files in static folder and formed like {% static .....} in html file and it work correctly. static folder is in myproject folder.(migration,static,template,..) when i path it in urls in the main page it work correctly. but when I give it an slug like 'p/' it doesn't work. because it search for staticfile in this folder: "GET /p/static/post/js/scripts.js HTTP/1.1" 404 2598" Instead of “static/post/js/scripts.js my app name is "post" . please help https://stackoverflow.com/questions/63613170/how-can-i-add-a-url-for-my-template-in-django-JUMP_LINK__&&__python__&&__JUMP_LINK/63613684#63613684

27th Aug 2020, 1:00 PM
Mohammad Hadi Hedayati
Mohammad Hadi Hedayati - avatar
2 Answers
+ 2
Did you tried changing static url from default to your new one??
1st Sep 2020, 3:46 PM
AKSHAY🇮🇳
AKSHAY🇮🇳 - avatar
0
The static and templates folder should be where your manage.py is placed.
9th Sep 2020, 4:36 AM
AJAY LINGAYAT
AJAY LINGAYAT - avatar