shijl0925 / Flask-AdminLTE3

Bootstrap AdminLTE3 Templatea dapted to the flask framework Flask-Admin
MIT License
53 stars 13 forks source link

templates referenced in flask-admin/base.html are not all correct #6

Closed slobinger closed 3 years ago

slobinger commented 3 years ago

Nice project - it would be really useful to be able to use AdminLTE without using its static files in the projects source code itself. Just found out that the base.html template references 'admin/layout.html' that is not correct and should be 'flask-admin/layout.html'.

Traceback

[2021-06-01 11:50:07,467] ERROR in app: Exception on / [GET]
Traceback (most recent call last):
  File "/home/lobi/workspace/soc-reporting-alerting/venv/lib/python3.8/site-packages/flask/app.py", line 2070, in wsgi_app
    response = self.full_dispatch_request()
  File "/home/lobi/workspace/soc-reporting-alerting/venv/lib/python3.8/site-packages/flask/app.py", line 1515, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/home/lobi/workspace/soc-reporting-alerting/venv/lib/python3.8/site-packages/flask/app.py", line 1513, in full_dispatch_request
    rv = self.dispatch_request()
  File "/home/lobi/workspace/soc-reporting-alerting/venv/lib/python3.8/site-packages/flask/app.py", line 1499, in dispatch_request
    return self.ensure_sync(self.view_functions[rule.endpoint])(**req.view_args)
  File "/home/lobi/workspace/soc-reporting-alerting/soc_reporter/flask_app/__init__.py", line 13, in home
    return render_template('index.html')
  File "/home/lobi/workspace/soc-reporting-alerting/venv/lib/python3.8/site-packages/flask/templating.py", line 147, in render_template
    return _render(
  File "/home/lobi/workspace/soc-reporting-alerting/venv/lib/python3.8/site-packages/flask/templating.py", line 128, in _render
    rv = template.render(context)
  File "/home/lobi/workspace/soc-reporting-alerting/venv/lib/python3.8/site-packages/jinja2/environment.py", line 1304, in render
    self.environment.handle_exception()
  File "/home/lobi/workspace/soc-reporting-alerting/venv/lib/python3.8/site-packages/jinja2/environment.py", line 925, in handle_exception
    raise rewrite_traceback_stack(source=source)
  File "/home/lobi/workspace/soc-reporting-alerting/soc_reporter/flask_app/templates/index.html", line 1, in top-level template code
    {% extends 'flask-admin/base.html' %}
  File "/home/lobi/workspace/soc-reporting-alerting/venv/lib/python3.8/site-packages/flask_adminlte3/templates/flask-admin/base.html", line 2, in top-level template code
    {% import 'admin/layout.html' as layout with context -%}
  File "/home/lobi/workspace/soc-reporting-alerting/venv/lib/python3.8/site-packages/flask/templating.py", line 59, in get_source
    return self._get_source_fast(environment, template)
  File "/home/lobi/workspace/soc-reporting-alerting/venv/lib/python3.8/site-packages/flask/templating.py", line 95, in _get_source_fast
    raise TemplateNotFound(template)
jinja2.exceptions.TemplateNotFound: admin/layout.html
172.24.160.1 - - [01/Jun/2021 11:50:07] "GET / HTTP/1.1" 500 -

Steps to reproduce:

If I have Time I am glad to provide a fix.

slobinger commented 3 years ago

I have just cloned the repo and a closer look. In 'base.html' there are the lines:

{% import 'admin/layout.html' as layout with context -%}
{% import 'flask-admin/layout.html' as adminlte_layout with context -%}

So I have to correct my issue - seems to be that there is a template referenced that is not part of this project. There should admin/layout.html come from? Or what do I miss here? Thanks :-)

slobinger commented 3 years ago

OK There is not problem with Flask-AdminLTE3. It just requires that Flask-Admin is installed. I know I have overlooked this in the documentation. sorry for the noise :-)