I have searched everything I can find on SO including this, flask blueprint template folder.
/root
__init__.py
run.py
/hrms
__init__.py
views.py
models.py
/static
/templates
__init__.py
layout.html
/hr
__init__.py
hr_template_test.html
I have also tried:
/hrms
__init__.py
views.py
models.py
/templates
__init__.py
hr_template_test.html
No matter where I put the hr_template_test.html
file, Flask will not find it. Here is what I have in __init__.py
:
from flask import Blueprint, render_template
hrms_blue = Blueprint('hrms', __name__, template_folder='templates')
@hrms_blue.route('/')
def index():
return render_template('hrms_data_view.html')
In run.py
:
from flask import Flask
from flask_debugtoolbar import DebugToolbarExtension
from application.views.hrms import hrms_blue
app = Flask(__name__)
app.register_blueprint(hrms_blue, url_prefix='/<hrms_id>')
I have tried:
return render_template('hr/hrms_data_view.html')
return render_template('application/templates/hr/hrms_data_view.html')
return render_template('templates/hr/hrms_data_view.html')
return render_template('hrms_data_view.html')
http://127.0.0.1/hrms
And Jinja2 complains it cannot find the html file.
I took out the __init__.py
from templates and hr. No I get, TypeError: index() takes no arguments (1 given)
.