My app is organized like this:
#---Project
# |---- core
# |_____ views.py
# |_____ __init__.py
# |_____ helpers.py
# |---- error_pages
# |_____ handlers.py
# |_____ templates
# |_____ 404.html
# |---- templates
# |_____ layout.html
# |_____ index.html
# |_____ temp.html
# |_____ tempform.html
# |_____ tempJS.html
# |---- static
# |_____ style.css
# |----- application.py
# |----- model.py
# |----- __init__.py
I want to handle errors in a folder error_pages.In this folder I have a handles.py with:
from flask import Blueprint, render_template
error_pages = Blueprint('error_pages',__name__, template_folder='/templates')
@error_pages.app_errorhandler(404)
def error_404(error):
return render_template('404.html'), 404
@error_pages.app_errorhandler(403)
def error_403(error):
return render_template('403.html'), 403
my init.py is:
# errors templates
from Project.error_pages.handlers import error_pages
app.register_blueprint(error_pages)
But I want to check if error code is ok and filled and non existing html page: the error is:
jinja2.exceptions.TemplateNotFound: 404.html
I have over Blueprint which are working (for users,...)
Can someone can help ?