"jinja2.exceptions.templatenotfound: base.html" Code Answer's
You're definitely familiar with the best coding language Whatever that developers use to develop their projects and they get all their queries like "jinja2.exceptions.templatenotfound: base.html" answered properly. Developers are finding an appropriate answer about jinja2.exceptions.templatenotfound: base.html related to the Whatever coding language. By visiting this online portal developers get answers concerning Whatever codes question like jinja2.exceptions.templatenotfound: base.html. Enter your desired code related query in the search bar and get every piece of information about Whatever code related question on jinja2.exceptions.templatenotfound: base.html.
jinja2.exceptions.templatenotfound: base.html
You must create your template files in the correct location; in the templates subdirectory next to the python module (== the module where you create your Flask app).
The error indicates that there is no home.html file in the templates/ directory. Make sure you created that directory in the same directory as your python module, and that you did in fact put a home.html file in that subdirectory. If your app is a package, the templates folder should be created inside the package.
myproject/
app.py
templates/
home.html
myproject/
mypackage/
__init__.py
templates/
home.html
Alternatively, if you named your templates folder something other than templates and don't want to rename it to the default, you can tell Flask to use that other directory.
app = Flask(__name__, template_folder='template') # still relative to module
You can ask Flask to explain how it tried to find a given template, by setting the EXPLAIN_TEMPLATE_LOADING option to True. For every template loaded, you'll get a report logged to the Flask app.logger, at level INFO.
This is what it looks like when a search is successful; in this example the foo/bar.html template extends the base.html template, so there are two searches:
[2019-06-15 16:03:39,197] INFO in debughelpers: Locating template "foo/bar.html":
1: trying loader of application "flaskpackagename"
class: jinja2.loaders.FileSystemLoader
encoding: 'utf-8'
followlinks: False
searchpath:
- /.../project/flaskpackagename/templates
-> found ('/.../project/flaskpackagename/templates/foo/bar.html')
[2019-06-15 16:03:39,203] INFO in debughelpers: Locating template "base.html":
1: trying loader of application "flaskpackagename"
class: jinja2.loaders.FileSystemLoader
encoding: 'utf-8'
followlinks: False
searchpath:
- /.../project/flaskpackagename/templates
-> found ('/.../project/flaskpackagename/templates/base.html')
Blueprints can register their own template directories too, but this is not a requirement if you are using blueprints to make it easier to split a larger project across logical units. The main Flask app template directory is always searched first even when using additional paths per blueprint.
All those coders who are working on the Whatever based application and are stuck on jinja2.exceptions.templatenotfound: base.html can get a collection of related answers to their query. Programmers need to enter their query on jinja2.exceptions.templatenotfound: base.html related to Whatever code and they'll get their ambiguities clear immediately. On our webpage, there are tutorials about jinja2.exceptions.templatenotfound: base.html for the programmers working on Whatever code while coding their module. Coders are also allowed to rectify already present answers of jinja2.exceptions.templatenotfound: base.html while working on the Whatever language code. Developers can add up suggestions if they deem fit any other answer relating to "jinja2.exceptions.templatenotfound: base.html". Visit this developer's friendly online web community, CodeProZone, and get your queries like jinja2.exceptions.templatenotfound: base.html resolved professionally and stay updated to the latest Whatever updates.