【发布时间】:2022-01-24 15:11:52
【问题描述】:
我需要在我的其他包中扩展 base.html。
我的应用结构
-flask_blog
|-- app_bone
| |-- __init__.py
| |-- blog
| | |-- __init__.py
| | |-- routes.py
| | |-- templates
| | | |-- blog
| | | | |-- blog.html
|-- templates
| |-- base.html
-run.py
app_bone/blog/route.py
from flask import render_template, Blueprint
blog = Blueprint('blog', __name__, template_folder='templates')
@blog.route('/')
def blog_list():
return render_template('blog/blog.html')
app_bone/templates/blog/blog.html
{% extends 'base.html' %}
{% block content %}
<h1> blog </h1>
{% endblock %}
我在运行烧瓶时发现了这个错误
jinja2.exceptions.TemplateNotFound: base.html
【问题讨论】: