[GH-ISSUE #507] [BUG] NoJS Links "jinja2.exceptions.UndefinedError: 'translation' is undefined" #328

Closed
opened 2026-02-25 20:35:28 +03:00 by kerem · 1 comment
Owner

Originally created by @gripped on GitHub (Oct 28, 2021).
Original GitHub issue: https://github.com/benbusby/whoogle-search/issues/507

Clicking a NoJS Link on my private instance results in an Internal server error. I know this CAN work as it's working on one of your listed public instances( which allowed config changes to enable the NoJS). The error:

  File "/home/whoogle/whoogle-search/app/templates/display.html", line 39, in top-level template code
    <a id="gh-link" href="https://github.com/benbusby/whoogle-search">{{ translation['github-link'] }}</a>
  File "/home/whoogle/whoogle-search/venv/lib/python3.9/site-packages/jinja2/environment.py", line 452, in getitem
    return obj[argument]
jinja2.exceptions.UndefinedError: 'translation' is undefined

If I edit the offending part of display.html to <a id="gh-link" href="https://github.com/benbusby/whoogle-search">View on GitHub</a> ,removing the translation, it works.

To Reproduce
Steps to reproduce the behavior:

  1. Do a search
  2. Click a NoJS Link
  3. See error

Deployment Method
Manual
Clean, just reinstalled
Nginx proxy
debian 11 on a vps.

Version of Whoogle Search
GitHub

Additional context
This has never worked for me for as long as I can remember. But I only took a look today after playing with #276
I suspect it's maybe related to the deployment method but IDK ?
No big deal for me but I thought I should let you know.

My Nginx conf

server {
    server_name whoogle.domain;
	root /var/www/whoogle;
    access_log /dev/null;
	error_log /dev/null;
	index index.html index.htm;
	
	location / {
		proxy_pass http://127.0.0.1:5000/;
		proxy_set_header X-Forwarded-For $remote_addr;
}
	
    listen 443 ssl; # managed by Certbot
    ssl_certificate /etc/letsencrypt/live/whoogle.domain/fullchain.pem; # managed by Certbot
    ssl_certificate_key /etc/letsencrypt/live/whoogle.domain/privkey.pem; # managed by Certbot
    include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
    ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot

}
  server {
    if ($host = whoogle.domain) {
        return 301 https://$host$request_uri;
    } # managed by Certbot


    server_name whoogle.domain;
    listen 80;
    return 404; # managed by Certbot
}

The full error log

Serving on http://0.0.0.0:5000
ERROR:app:Exception on /window [GET]
Traceback (most recent call last):
  File "/home/whoogle/whoogle-search/venv/lib/python3.9/site-packages/flask/app.py", line 2446, in wsgi_app
    response = self.full_dispatch_request()
  File "/home/whoogle/whoogle-search/venv/lib/python3.9/site-packages/flask/app.py", line 1951, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/home/whoogle/whoogle-search/venv/lib/python3.9/site-packages/flask/app.py", line 1820, in handle_user_exception
    reraise(exc_type, exc_value, tb)
  File "/home/whoogle/whoogle-search/venv/lib/python3.9/site-packages/flask/_compat.py", line 39, in reraise
    raise value
  File "/home/whoogle/whoogle-search/venv/lib/python3.9/site-packages/flask/app.py", line 1949, in full_dispatch_request
    rv = self.dispatch_request()
  File "/home/whoogle/whoogle-search/venv/lib/python3.9/site-packages/flask/app.py", line 1935, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "/home/whoogle/whoogle-search/app/routes.py", line 42, in decorated
    return f(*args, **kwargs)
  File "/home/whoogle/whoogle-search/app/routes.py", line 388, in window
    return render_template('display.html', response=results)
  File "/home/whoogle/whoogle-search/venv/lib/python3.9/site-packages/flask/templating.py", line 137, in render_template
    return _render(
  File "/home/whoogle/whoogle-search/venv/lib/python3.9/site-packages/flask/templating.py", line 120, in _render
    rv = template.render(context)
  File "/home/whoogle/whoogle-search/venv/lib/python3.9/site-packages/jinja2/environment.py", line 1090, in render
    self.environment.handle_exception()
  File "/home/whoogle/whoogle-search/venv/lib/python3.9/site-packages/jinja2/environment.py", line 832, in handle_exception
    reraise(*rewrite_traceback_stack(source=source))
  File "/home/whoogle/whoogle-search/venv/lib/python3.9/site-packages/jinja2/_compat.py", line 28, in reraise
    raise value.with_traceback(tb)
  File "/home/whoogle/whoogle-search/app/templates/display.html", line 39, in top-level template code
    <a id="gh-link" href="https://github.com/benbusby/whoogle-search">{{ translation['github-link'] }}</a>
  File "/home/whoogle/whoogle-search/venv/lib/python3.9/site-packages/jinja2/environment.py", line 452, in getitem
    return obj[argument]
jinja2.exceptions.UndefinedError: 'translation' is undefined
Originally created by @gripped on GitHub (Oct 28, 2021). Original GitHub issue: https://github.com/benbusby/whoogle-search/issues/507 Clicking a NoJS Link on my private instance results in an Internal server error. I know this CAN work as it's working on one of your listed public instances( which allowed config changes to enable the NoJS). The error: ``` File "/home/whoogle/whoogle-search/app/templates/display.html", line 39, in top-level template code <a id="gh-link" href="https://github.com/benbusby/whoogle-search">{{ translation['github-link'] }}</a> File "/home/whoogle/whoogle-search/venv/lib/python3.9/site-packages/jinja2/environment.py", line 452, in getitem return obj[argument] jinja2.exceptions.UndefinedError: 'translation' is undefined ``` If I edit the offending part of display.html to `<a id="gh-link" href="https://github.com/benbusby/whoogle-search">View on GitHub</a>` ,removing the translation, it works. **To Reproduce** Steps to reproduce the behavior: 1. Do a search 2. Click a NoJS Link 4. See error **Deployment Method** Manual Clean, just reinstalled Nginx proxy debian 11 on a vps. **Version of Whoogle Search** GitHub **Additional context** This has never worked for me for as long as I can remember. But I only took a look today after playing with #276 I suspect it's maybe related to the deployment method but IDK ? No big deal for me but I thought I should let you know. My Nginx conf ``` server { server_name whoogle.domain; root /var/www/whoogle; access_log /dev/null; error_log /dev/null; index index.html index.htm; location / { proxy_pass http://127.0.0.1:5000/; proxy_set_header X-Forwarded-For $remote_addr; } listen 443 ssl; # managed by Certbot ssl_certificate /etc/letsencrypt/live/whoogle.domain/fullchain.pem; # managed by Certbot ssl_certificate_key /etc/letsencrypt/live/whoogle.domain/privkey.pem; # managed by Certbot include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot } server { if ($host = whoogle.domain) { return 301 https://$host$request_uri; } # managed by Certbot server_name whoogle.domain; listen 80; return 404; # managed by Certbot } ``` The full error log ``` Serving on http://0.0.0.0:5000 ERROR:app:Exception on /window [GET] Traceback (most recent call last): File "/home/whoogle/whoogle-search/venv/lib/python3.9/site-packages/flask/app.py", line 2446, in wsgi_app response = self.full_dispatch_request() File "/home/whoogle/whoogle-search/venv/lib/python3.9/site-packages/flask/app.py", line 1951, in full_dispatch_request rv = self.handle_user_exception(e) File "/home/whoogle/whoogle-search/venv/lib/python3.9/site-packages/flask/app.py", line 1820, in handle_user_exception reraise(exc_type, exc_value, tb) File "/home/whoogle/whoogle-search/venv/lib/python3.9/site-packages/flask/_compat.py", line 39, in reraise raise value File "/home/whoogle/whoogle-search/venv/lib/python3.9/site-packages/flask/app.py", line 1949, in full_dispatch_request rv = self.dispatch_request() File "/home/whoogle/whoogle-search/venv/lib/python3.9/site-packages/flask/app.py", line 1935, in dispatch_request return self.view_functions[rule.endpoint](**req.view_args) File "/home/whoogle/whoogle-search/app/routes.py", line 42, in decorated return f(*args, **kwargs) File "/home/whoogle/whoogle-search/app/routes.py", line 388, in window return render_template('display.html', response=results) File "/home/whoogle/whoogle-search/venv/lib/python3.9/site-packages/flask/templating.py", line 137, in render_template return _render( File "/home/whoogle/whoogle-search/venv/lib/python3.9/site-packages/flask/templating.py", line 120, in _render rv = template.render(context) File "/home/whoogle/whoogle-search/venv/lib/python3.9/site-packages/jinja2/environment.py", line 1090, in render self.environment.handle_exception() File "/home/whoogle/whoogle-search/venv/lib/python3.9/site-packages/jinja2/environment.py", line 832, in handle_exception reraise(*rewrite_traceback_stack(source=source)) File "/home/whoogle/whoogle-search/venv/lib/python3.9/site-packages/jinja2/_compat.py", line 28, in reraise raise value.with_traceback(tb) File "/home/whoogle/whoogle-search/app/templates/display.html", line 39, in top-level template code <a id="gh-link" href="https://github.com/benbusby/whoogle-search">{{ translation['github-link'] }}</a> File "/home/whoogle/whoogle-search/venv/lib/python3.9/site-packages/jinja2/environment.py", line 452, in getitem return obj[argument] jinja2.exceptions.UndefinedError: 'translation' is undefined ```
kerem 2026-02-25 20:35:28 +03:00
  • closed this issue
  • added the
    bug
    label
Author
Owner

@benbusby commented on GitHub (Oct 29, 2021):

Thanks for reporting! Should be fixed now.

<!-- gh-comment-id:954384489 --> @benbusby commented on GitHub (Oct 29, 2021): Thanks for reporting! Should be fixed now.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/whoogle-search#328
No description provided.