Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

197
Vistas
Why is {% block content %} causing server 500 error in Django?

I have been trying to use the Django template inheritance feature for my project Since I've added {% block content %}s I am now getting a server error 500 whenever I try to run the child template. The base template runs fine. I am quite sure it has something to do with the content blocks, but I'm not sure why as I don't repeat any names of blocks and everything on the child template is contained within a block. The console says two errors:

Failed to load resource: the server responded with a status of 404 (Not Found)

Failed to load resource: the server responded with a status of 500 (Internal Server Error)

Code goes like this:

Base.html

<!DOCTYPE html>

<style>
'My style'
</style>

<html lang='en'>
<head>
    <meta charset='UTF-8'
    {% block title %}
        webpage
    {% endblock %}
    <script>'Jquery reference'</script>
</head>

{% block script %}
    'empty'
{% endblock %}

<body>
<div id='navbar'>
    'My navbar'
</div>

<div id='main_content_block'>
    {% block content %}
        <h1>This is my base</h1>
    {% endblock %}
</div>

</body>
</html>


    

Home.html

{% extends 'main/base.html' %}

{% block title %}
<title>Home</title>
{% endblock %}

{% block script %}
'My javascript'
{% endblock %}

{% block content %}
'My content'
{% endblock %}

Thanks for your time

about 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

Django couldn't find base.html and including the absolute path instead of the relative fixed it.

about 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda