DjangoGirls / djangogirls

Website for DjangoGirls.org
http://djangogirls.org/
BSD 3-Clause "New" or "Revised" License
462 stars 283 forks source link

TemplateDoesNotExist: captcha/widget_nocaptcha.html #690

Closed sentry-io[bot] closed 3 years ago

sentry-io[bot] commented 3 years ago

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 commented 3 years ago

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

marksweb commented 3 years ago

@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 commented 3 years ago

Ok @marksweb, I was about to ask if recaptcha versions changed after reading this https://github.com/springload/wagtail-django-recaptcha/issues/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 commented 3 years ago

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.