Home > Software design >  Django {% extends 'base.html' %} {% block content %} {% load static %} does not work, noth
Django {% extends 'base.html' %} {% block content %} {% load static %} does not work, noth

Time:10-29

I have a html template i want to code in django. For now i need to take the header and footer parts and make images, css and js into static files. I tried to do it but it does not quite work, can anyone help me with it? I would greatly appreciate if someone can fix my mistakes and send me the file

{% extends 'base.html' %} {% block content %} {% load static %} none of them work

CodePudding user response:

Try changing the HTML file to base.html.js or make sure that the template directory is configured correctly in settings.py

for reference
TEMPLATES = [

'DIRS' = [os.path.join(base_directory, 'template_directory')]

]

CodePudding user response:

Hi ai ohto for {% load static %} read this Django documentation: documentation

or in short add this to your project settings.py file:

STATIC_URL = 'static/'
STATICFILES_DIRS=[
   os.path.join(BASE_DIR, 'YourDjangoAppName/YourStaticFolderName'),
]

for {% extends 'base.html' %} {% block content %} you have to provide more information. Its better to add your code to your question.

  • Related