Skip to content

Running server from different folder raises Internal Server Error. #54

@fatality14

Description

@fatality14

I use Windows 11 with custom python path.
So I have to run the server from the other directory than the project one.

I have just two folder here:

exllamav2/system #python folder
exllamav2/exui #ui folder

Run log:

C:\Programs\exllamav2>.\system\python.exe exui/server.py
 -- User dir: ~/exui
 -- Starting server on localhost port 5000
 -- Opening UI in default web browser
ERROR:ExUI:Exception on / [GET]
Traceback (most recent call last):
  File "C:\AYNP\exllamav2\system\lib\site-packages\flask\app.py", line 1473, in wsgi_app
    response = self.full_dispatch_request()
  File "C:\AYNP\exllamav2\system\lib\site-packages\flask\app.py", line 882, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "C:\AYNP\exllamav2\system\lib\site-packages\flask\app.py", line 880, in full_dispatch_request
    rv = self.dispatch_request()
  File "C:\AYNP\exllamav2\system\lib\site-packages\flask\app.py", line 865, in dispatch_request
    return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)  # type: ignore[no-any-return]
  File "C:\AYNP\exllamav2\exui\server.py", line 50, in home
    return render_template("index.html")
  File "C:\AYNP\exllamav2\system\lib\site-packages\flask\templating.py", line 149, in render_template
    template = app.jinja_env.get_or_select_template(template_name_or_list)
  File "C:\AYNP\exllamav2\system\lib\site-packages\jinja2\environment.py", line 1084, in get_or_select_template
    return self.get_template(template_name_or_list, parent, globals)
  File "C:\AYNP\exllamav2\system\lib\site-packages\jinja2\environment.py", line 1013, in get_template
    return self._load_template(name, globals)
  File "C:\AYNP\exllamav2\system\lib\site-packages\jinja2\environment.py", line 972, in _load_template
    template = self.loader.load(self, name, self.make_globals(globals))
  File "C:\AYNP\exllamav2\system\lib\site-packages\jinja2\loaders.py", line 126, in load
    source, filename, uptodate = self.get_source(environment, name)
  File "C:\AYNP\exllamav2\system\lib\site-packages\flask\templating.py", line 65, in get_source
    return self._get_source_fast(environment, template)
  File "C:\AYNP\exllamav2\system\lib\site-packages\flask\templating.py", line 99, in _get_source_fast
    raise TemplateNotFound(template)
jinja2.exceptions.TemplateNotFound: index.html

image

I fix the problem manually adding:

abspath = os.path.abspath(__file__)
dname = os.path.dirname(abspath)
os.chdir(dname)

at the start of server.py for now, so it forces to change the root directory.

The problem is caused by templates directory link, so a general solution would be nice.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions