Hi all,
I'm using Flask-Admin so that the website url with /admin at the end opens the admin page. However, I'm having issues opening it from a python script. Any ideas what's going on?
Thanks!
@app.route('/admin', methods=["GET", "POST"])
def mesage_post():
if request.method == 'POST':
result = request.form
message= result.get('Message')
message2= result.get('Message2')
return render_template("admin/index.html", result = result, message = message, message2 = message2)
else:
return render_template("admin/index.html")
The main admin page is stored in templates/admin/index.html and typing in the standard url of the website with /admin at the end works fine but using this code which should open the same file at the same URL, I get the error:
2018-02-12 14:32:08,352: jinja2.exceptions.UndefinedError: 'admin_base_template' is undefined
This seems to be on the index.html page itself but why I'm confused as to why it works when opening the page manually?
Index.html extends the main Flask-Admin page:
{% extends 'admin/master.html' %}
{% block head_css %}
{{ super() }}
<link href="{{ url_for('static', filename='admincsstest') }}" rel="stylesheet">
{% endblock head_css %}
<{% block body %}
{{ super() }}
Any help would be appreciated! Thanks.