-
-
Notifications
You must be signed in to change notification settings - Fork 16.6k
Closed
Description
When constructing the Flask object, it would be nice if template_folder could be either a string (currently) or a pathlib.Path object. This would match static_folder, which is currently typed as Union[str, os.PathLike]. That functionality was added in #3579; I was unable to find any reason why the same wasn't done for template_folder, so I assume it was an unintentional omission.
https://flask.palletsprojects.com/en/2.2.x/api/#application-object
Not having this functionality is not a dealbreaker, as it's pretty simple to do template_folder=str(path), but it would be nice and match static_folder. In SecureDrop our code is going to look like:
app = Flask(
__name__,
template_folder=str(config.JOURNALIST_TEMPLATES_DIR.absolute()),
static_folder=config.STATIC_DIR,
)...so implementing this would be nice.