templates
should be a subfolder of where the services
package, or you need to set a custom template_folder
argument when creating the Flask()
app object:
app = Flask(__name__, template_folder='../templates')
Pregunta
My structure for files is this.
-App
-services
- __init__.py
- app_file.py
-templates
- hello.html
Inside app_file.py, I've got
@app.route('/')
def hello():
return render_template('hello.html')
I know I have at least got a working "hello world" program, because this much worked
@app.route('/')
def hello():
return 'Hello World'
However, when I attempt the templated html, I get this error.
jinja2.exceptions.TemplateNotFound
As I said, I'm almost positive it is something with my file structure, so I posted only what I feel is necesary to determine if I am right or not, but will post more upon request. Help please?
No hay solución correcta
Otros consejos
templates
should be a subfolder of where the services
package, or you need to set a custom template_folder
argument when creating the Flask()
app object:
app = Flask(__name__, template_folder='../templates')