2
反应,我需要获取上下文中使用Django 反应,但我不能做到这一点如何获取上下文使用Django
这是我的代码 在我的JSX
<h1>{{titulo}}</h1>
<h2>{{ejemplo}}</h2>
在我的模板
:
{% load staticfiles %}
<!DOCTYPE html>
<html>
<head>
<title>Index</title>
</head>
<body >
<div id="app"></div>
<script type="text/javascript" src="{% static 'bundle.js' %}"></script>
</body>
</html>
在我看来py:
def registro (request,giro):
reg = 'Registro Normal'
if giro==1:
reg='Registro Especial'
context = {
'ejemplo':'tests',
'titulo':reg
}
return render(request,'home/registro.html',context)
但不渲染和表现出野生错误:(
未捕获的ReferenceError:TITULO没有定义
谢谢! :')Muchas gracias !! –