defeo / jupyterhub-docker

A configuration for a JupyterHub+DockerSpawner+CASAuthenticator server with Traefik proxy, based on docker-compose
https://opendreamkit.org/2018/10/17/jupyterhub-docker/
MIT License
201 stars 112 forks source link

TemplateNotFound: login.html #13

Closed Dmitry1987 closed 4 years ago

Dmitry1987 commented 4 years ago

Hi, thanks a lot for sharing this great setup, it's really good! I got an error about some template, my setup is all defaults except domain name and auth settings, but I think I did no mistakes in those settings ... also I used the traefik 1.7 version like was suggested in another bug about new version errors.

Here is my log, did anyone encounter that?

[I 2019-12-19 07:24:20.178 JupyterHub log:174] 302 GET / -> /hub/ (@myip) 1.49ms
[I 2019-12-19 07:24:20.286 JupyterHub log:174] 302 GET /hub/ -> /hub/login (@myip) 0.92ms
[E 2019-12-19 07:24:20.394 JupyterHub web:1788] Uncaught exception GET /hub/login (myip)
    HTTPServerRequest(protocol='http', host='notebooks.mydomain.com', method='GET', uri='/hub/login', version='HTTP/1.1', remote_ip='myip')
    Traceback (most recent call last):
      File "/usr/local/lib/python3.6/dist-packages/tornado/web.py", line 1699, in _execute
        result = await result
      File "/usr/local/lib/python3.6/dist-packages/jupyterhub/handlers/login.py", line 135, in get
        self.finish(self._render(username=username))
      File "/usr/local/lib/python3.6/dist-packages/jupyterhub/handlers/login.py", line 102, in _render
        {'next': self.get_argument('next', '')},
      File "/usr/local/lib/python3.6/dist-packages/jupyterhub/handlers/base.py", line 1119, in render_template
        template = self.get_template(name)
      File "/usr/local/lib/python3.6/dist-packages/jupyterhub/handlers/base.py", line 1113, in get_template
        return self.settings['jinja2_env'].get_template(name)
      File "/usr/local/lib/python3.6/dist-packages/jinja2/environment.py", line 830, in get_template
        return self._load_template(name, self.make_globals(globals))
      File "/usr/local/lib/python3.6/dist-packages/jinja2/environment.py", line 804, in _load_template
        template = self.loader.load(self, name, globals)
      File "/usr/local/lib/python3.6/dist-packages/jinja2/loaders.py", line 408, in load
        raise TemplateNotFound(name)
    jinja2.exceptions.TemplateNotFound: login.html

[E 2019-12-19 07:24:20.397 JupyterHub web:1216] Uncaught exception in write_error
    Traceback (most recent call last):
      File "/usr/local/lib/python3.6/dist-packages/tornado/web.py", line 1214, in send_error
        self.write_error(status_code, **kwargs)
      File "/usr/local/lib/python3.6/dist-packages/jupyterhub/handlers/base.py", line 1203, in write_error
        html = self.render_template('error.html', **ns)
      File "/usr/local/lib/python3.6/dist-packages/jupyterhub/handlers/base.py", line 1119, in render_template
        template = self.get_template(name)
      File "/usr/local/lib/python3.6/dist-packages/jupyterhub/handlers/base.py", line 1113, in get_template
        return self.settings['jinja2_env'].get_template(name)
      File "/usr/local/lib/python3.6/dist-packages/jinja2/environment.py", line 830, in get_template
        return self._load_template(name, self.make_globals(globals))
      File "/usr/local/lib/python3.6/dist-packages/jinja2/environment.py", line 804, in _load_template
        template = self.loader.load(self, name, globals)
      File "/usr/local/lib/python3.6/dist-packages/jinja2/loaders.py", line 408, in load
        raise TemplateNotFound(name)
    jinja2.exceptions.TemplateNotFound: error.html

[E 2019-12-19 07:24:20.398 JupyterHub log:166] {
      "X-Real-Ip": "myip",
      "X-Forwarded-Server": "2d1333d53107",
      "X-Forwarded-Proto": "http,http",
      "X-Forwarded-Port": "80,80",
      "X-Forwarded-Host": "notebooks.mydomain.com",
      "X-Forwarded-For": "lol almost missed that ip to hide right here,::ffff:172.18.0.2",
      "Upgrade-Insecure-Requests": "1",
      "Cache-Control": "max-age=0",
      "Accept-Language": "en-US,en;q=0.9",
      "Accept-Encoding": "gzip, deflate",
      "Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3",
      "User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.108 Safari/537.36",
      "Host": "notebooks.mydomain.com",
      "Connection": "close"
    }
[E 2019-12-19 07:24:20.398 JupyterHub log:174] 500 GET /hub/login (@myip) 4.73ms
defeo commented 4 years ago

Strange. Looks like JupyterHub is not properly installed in its container. Did you change the version in the Dockerfile?

Dmitry1987 commented 4 years ago

Hi, something fixed it, I am not sure what. But yes I tried both 1.0 and 0.9.3, it was the same. I think it is my domain name related error, I changed the domain name in HOST variable to the correct one and it now works. Thanks @defeo ! I'll report back with any improvements I'll do in my iteration on this, and will send a PR if it'll be useful.

Dmitry1987 commented 4 years ago

I found exactly what it was: the 1.0 docker image! it was the main reason. so it's just broken.