Templates not found in Flask Blueprint

flask, python

Solution

You are not accurate about docs. Your templates shoud be in

myapp/admin/templates/admin/index.html.jinja2

Note `admin` folder in `templates`.

Problem

I'm working on an app using Blueprints and I followed the documentation quickstart on Blueprints, but still have a 404 on my templates. I got an `admin` blueprint looking like that: ``` from flask import Blueprint, render_template admin = Blueprint('admin', __name__, template_folder='templates') @admin.route('/') def admin_index(): return render_template('admin/index.html.jinja2') ``` As described in the doc, my template is in /myapp/admin/templates/index.html.jinja2+ I register the blueprint in my app `__init__.py` file: ``` from flask import Flask from . import config from admin import admin app = Flask(__name__) app.config.from_object(config.DevelopmentConfig) # register my blueprint app.register_blueprint(admin, url_prefix='/admin/') ``` If anyone has an idea about a mistake I could have done, please tell me!

Original source