The checkbox looks for templates/frontend/src/view_notifications.html for your template file. You need to either move the template file to this location or change the default templates folder.
According to the Flask docs, you can specify a different folder for your templates. By default, it is equal to templates/ in the root of your application:
import os from flask import Flask template_dir = os.path.abspath('../../frontend/src') app = Flask(__name__, template_folder=template_dir)
UPDATE:
After testing on a Windows computer, the templates folder should be called templates . This is the code I used:
import os from flask import Flask, render_template template_dir = os.path.dirname(os.path.dirname(os.path.abspath(os.path.dirname(__file__)))) template_dir = os.path.join(template_dir, 'frontend') template_dir = os.path.join(template_dir, 'templates') # hard coded absolute path for testing purposes working = 'C:\Python34\pro\\frontend\\templates' print(working == template_dir) app = Flask(__name__, template_folder=template_dir) @app.route("/") def hello(): return render_template('index.html') if __name__ == "__main__": app.run(debug=True)
With this structure:
|-pro |- backend |- app.py |- frontend |- templates |- index.html
Changing any instance from 'templates' to 'src' and renaming the templates folder to 'src' led to the same error that the OP got.
Iananuld
source share