Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TemplateDoesNotExist: captcha/widget_nocaptcha.html #690

Closed
sentry-io bot opened this issue Sep 20, 2021 · 4 comments
Closed

TemplateDoesNotExist: captcha/widget_nocaptcha.html #690

sentry-io bot opened this issue Sep 20, 2021 · 4 comments

Comments

@sentry-io
Copy link

sentry-io bot commented Sep 20, 2021

Sentry Issue: DJANGO-GIRLS-WEBSITE-26

TemplateDoesNotExist: captcha/widget_nocaptcha.html
  File "django/template/backends/django.py", line 34, in get_template
    return Template(self.engine.get_template(template_name), self)
  File "django/template/engine.py", line 143, in get_template
    template, origin = self.find_template(template_name)
  File "django/template/engine.py", line 129, in find_template
    raise TemplateDoesNotExist(name, tried=tried)

TemplateDoesNotExist: captcha/widget_nocaptcha.html
(23 additional frame(s) were not displayed)
...
  File "django/forms/widgets.py", line 247, in _render
    return mark_safe(renderer.render(template_name, context))
  File "django/forms/renderers.py", line 30, in render
    template = self.get_template(template_name)
  File "django/forms/renderers.py", line 36, in get_template
    return self.engine.get_template(template_name)
  File "django/template/backends/django.py", line 36, in get_template
    reraise(exc, self)
  File "django/template/backends/django.py", line 84, in reraise
    raise new from exc

TemplateDoesNotExist: captcha/widget_nocaptcha.html
(2 additional frame(s) were not displayed)
...
  File "django/core/handlers/base.py", line 143, in _get_response
    response = response.render()
  File "django/template/response.py", line 106, in render
    self.content = self.rendered_content
  File "django/template/response.py", line 83, in rendered_content
    content = template.render(context, self._request)
  File "django/template/backends/django.py", line 63, in render
    reraise(exc, self.backend)
  File "django/template/backends/django.py", line 84, in reraise
    raise new from exc
@amakarudze
Copy link
Contributor

Hey @marksweb. This error is causing a 500 Server Error when people browse contact page and other pages with a captcha.

@marksweb
Copy link
Collaborator

@amakarudze I've not really understood what happened yet with that deployment, but this suggests something odd with the recaptcha version installed.

The version that should be installed after you reverted is django-recaptcha 1.4.0

The version that was upgraded in the django 3 change was to 2.0.6. In this version that template doesn't exist anymore.

Heres the templates in 2.0.6; https://github.com/praekelt/django-recaptcha/tree/2.0.6/captcha/templates/captcha

And 1.4.0; https://github.com/praekelt/django-recaptcha/tree/1.4.0/captcha/templates/captcha

The python code being executed must match 1.4, where that template is the default; https://github.com/praekelt/django-recaptcha/blob/1.4.0/captcha/client.py#L13

But the templates directory can't be the 1.4 version I assume.

Might be worth running pip-sync on the server, just to make sure it's running the correct packages after the revert.

@amakarudze
Copy link
Contributor

Ok @marksweb, I was about to ask if recaptcha versions changed after reading this wagtail-nest/wagtail-django-recaptcha#27. Let me try and run pip-sync and also check the version we are running.

I also haven't understood what happened with the deployment. There were just too many errors I haven't even had the strength to read them all. Will probably try to do that tomorrow.

@amakarudze
Copy link
Contributor

I just ran pip-sync and everything is up-to-date. Probably since the last deployment failed, the server did not refresh from Django 3.2 update though the venv had recaptcha version 1.4.0 and not 2.0.6. It's now working so am closing this issue now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants