I'm getting this error when running Kitana via systemd (code at bottom of post) but not when just running Kitana directly from terminal via python3.9 kitana.py . Kitana is running on the same machine as the plex server and no proxy/etc is involved. We are also accessing it from the same local network that Plex is on.
500 Internal Server Error
The server encountered an unexpected condition which prevented it from fulfilling the request.
Traceback (most recent call last):
File "/home/<username censored>/.local/lib/python3.9/site-packages/cherrypy/_cprequest.py", line 638, in respond
self._do_respond(path_info)
File "/home/<username censored>/.local/lib/python3.9/site-packages/cherrypy/_cprequest.py", line 697, in _do_respond
response.body = self.handler()
File "/home/<username censored>/.local/lib/python3.9/site-packages/cherrypy/lib/encoding.py", line 223, in __call__
self.body = self.oldhandler(*args, **kwargs)
File "/home/<username censored>/.local/lib/python3.9/site-packages/cherrypy/_cpdispatch.py", line 54, in __call__
return self.callable(*self.args, **self.kwargs)
File "/opt/Kitana/kitana.py", line 564, in get_plex_token
return template.render(plex_headers_json=json.dumps(self.plex_headers), **self.default_context)
File "/home/<username censored>/.local/lib/python3.9/site-packages/jinja2/environment.py", line 1291, in render
self.environment.handle_exception()
File "/home/<username censored>/.local/lib/python3.9/site-packages/jinja2/environment.py", line 925, in handle_exception
raise rewrite_traceback_stack(source=source)
File "/opt/Kitana/templates/token.jinja2", line 1, in top-level template code
{% extends "base.jinja2" %}
File "/opt/Kitana/templates/base.jinja2", line 16, in top-level template code
<link rel="stylesheet" href="{{ static("/static/css/main.css") }}"/>
File "/home/<username censored>/.local/lib/python3.9/site-packages/jinja2/utils.py", line 84, in from_obj
if hasattr(obj, "jinja_pass_arg"):
jinja2.exceptions.UndefinedError: 'static' is undefined
Powered by [CherryPy 18.6.1](http://www.cherrypy.org/)
[Unit]
Description=Kitana - Web interface for Plex plug-ins
After=network-online.target
[Service]
ExecStart=/usr/bin/python3.9 /opt/Kitana/kitana.py
GuessMainPID=no
Type=forking
User=<username censored, same username as above>
Group=<groupname same as username>
[Install]
WantedBy=multi-user.target
I'm getting this error when running Kitana via systemd (code at bottom of post) but not when just running Kitana directly from terminal via python3.9 kitana.py . Kitana is running on the same machine as the plex server and no proxy/etc is involved. We are also accessing it from the same local network that Plex is on.
Systemd code: