0

I have the following structure

/templates/base.html templates/index.html --- here i have inherited base.html which has JS and CSS and both working fine when this pagge is accessed

/template/app/some.html ---- i use {%extends "base.html"%} only is getting inherted but not the CSS and JS

can any one tell what i am doing wrong

Thank You

1 Answer 1

2

Your issue happens because when you are in say: mysite.com/index.html, your files pointed to css/mysite.css try to load from mysite.com/css/mysite.css, but when you are in mysite.com/foo/bar.html it tries to load from mysite.com/foo/css/mysite.css

The best option is to point to your CSS/JS with an absolute path, so say your CSS always loads from /css/mysite.css and your JS loads from /js/mysite.js. Notice the prepended / as this is what instructs the browser to always look for this path relative to the base domain.

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks for that reply i tried putting it like /media/app/css and /media/app/js accesing mysite.com/app/some.html -- which extends base.html Its not working yet can u just elaborate. thank you

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.