I have the same problem and i have it was working at the start and the wen i add exter code me (‘/‘) page said jinja2.exceptions.templatenotfound: so i did what you said and i made it the absolute path and it still does work can you help me find the right answer as I’ve look all over the internet and cant find the answer this is my code
Define a route for the dashboard page
@app.route('/')
def dashboard():
return render_template('/home/Edpdash/XXXX/templates/dash_board.html')
What am i doing wrong if it worked at the start with
Return render_template(‘dash_board.html’)
Can you please look at my code and tell me what i have dont wrong
This is my error report
2023-03-05 21:44:03,551: Exception on / [GET]
Traceback (most recent call last):
File "/usr/local/lib/python3.10/site-packages/flask/app.py", line 2077, in wsgi_app
response = self.full_dispatch_request()
File "/usr/local/lib/python3.10/site-packages/flask/app.py", line 1525, in full_dispatch_request
rv = self.handle_user_exception(e)
File "/usr/local/lib/python3.10/site-packages/flask/app.py", line 1523, in full_dispatch_request
rv = self.dispatch_request()
File "/usr/local/lib/python3.10/site-packages/flask/app.py", line 1509, in dispatch_request
return self.ensure_sync(self.view_functions[rule.endpoint])(**req.view_args)
File "/home/Edpdash/Edp/website.py", line 24, in dashboard
return render_template('/home/Edpdash/XXX/templates/dash_board.html')
File "/usr/local/lib/python3.10/site-packages/flask/templating.py", line 149, in render_template
ctx.app.jinja_env.get_or_select_template(template_name_or_list),
File "/home/Edpdash/.local/lib/python3.10/site-packages/jinja2/environment.py", line 1068, in get_or_select_template
return self.get_template(template_name_or_list, parent, globals)
File "/home/Edpdash/.local/lib/python3.10/site-packages/jinja2/environment.py", line 997, in get_template
return self._load_template(name, globals)
File "/home/Edpdash/.local/lib/python3.10/site-packages/jinja2/environment.py", line 958, in _load_template
template = self.loader.load(self, name, self.make_globals(globals))
File "/home/Edpdash/.local/lib/python3.10/site-packages/jinja2/loaders.py", line 125, in load
source, filename, uptodate = self.get_source(environment, name)
File "/usr/local/lib/python3.10/site-packages/flask/templating.py", line 59, in get_source
return self._get_source_fast(environment, template)
File "/usr/local/lib/python3.10/site-packages/flask/templating.py", line 95, in _get_source_fast
raise TemplateNotFound(template)
jinja2.exceptions.TemplateNotFound: /home/Edpdash/XXXX/templates/dash_board.html