I have a Flask blueprint packages structure like that:
application/
-- __init__.py
-- extensions.py
-- authentication/
-- templates/
-- register.html
-- __init__.py
-- views.py
templates/
-- base.html
static/
main.py
database.db
In my authentication/__init__.py
:
from flask import Blueprint
authentication = Blueprint("authentication", __name__, template_folder="templates")
from . import views
In my authentication/views.py
:
# REGISTER PAGE
@authentication.route('/register', methods=['GET', 'POST'])
def register():
...
return render_template("register.html", form=form)
In my app/__init__.py
:
def create_app():
# INSTANTIATE APP
app = Flask(__name__)
...
app.register_blueprint(authentication, url_prefix="/")
...
Does someone knows what is wrong and why do I get jinja2.exceptions.TemplateNotFound: base.html
on register page?
I have tried to do everything like stop and restart, putting base.html
in the authentication.templates
works but once it is in the root.templates
it is written as not found.