在Django中显示普通HTML而不是验证码小部件?

在Django中显示普通HTML而不是验证码小部件?,django,recaptcha,Django,Recaptcha,我使用的是谷歌的recaptcha客户端。我注册并获取本地主机的私钥和公钥。 我正在向模板发送重新验证码,如下所示: from django.conf import settings from summary.captcha import displayhtml public_key = settings.RECAPTCHA_PUBLIC_KEY script = displayhtml(public_key=public_key) return render_to_response('i

我使用的是谷歌的recaptcha客户端。我注册并获取本地主机的私钥和公钥。 我正在向模板发送重新验证码,如下所示:

from django.conf import settings
from summary.captcha import displayhtml

 public_key = settings.RECAPTCHA_PUBLIC_KEY
 script = displayhtml(public_key=public_key)
return render_to_response('index.html', {'state':state, 'script':script}, context_instance=RequestContext(request))
显示此html而不是小部件:

<script type="text/javascript" src="http://www.google.com/recaptcha/api/challenge?k=6Lf5Cd8SAAAAAD9TUGVAkEOHfHJWnZc9mK2lO5-W"></script> <noscript> <iframe src="http://www.google.com/recaptcha/api/noscript?k=6Lf5Cd8SAAAAAD9TUGVAkEOHfHJWnZc9mK2lO5-W" height="300" width="500" frameborder="0"></iframe><br /> <textarea name="recaptcha_challenge_field" rows="3" cols="40"></textarea> <input type='hidden' name='recaptcha_response_field' value='manual_challenge' /> </noscript>


怎么了?

您必须将
脚本
变量标记为安全变量

在模板中,您可以执行以下操作:

{{ script|safe }}

也许你遗漏了一些东西,需要在密码中输入