Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

API Basics should introduce FileSystemLoader instead of PackageLoader #91

Closed
rubic opened this issue Jan 21, 2012 · 1 comment
Closed
Labels

Comments

@rubic
Copy link

rubic commented Jan 21, 2012

Every time I visit this page, I'm momentarily confused, then realize it's introducing the PackageLoader instead of FileSystemLoader:

http://jinja.pocoo.org/docs/api/

Not only is PackageLoader more difficult to intuit on first reading, but FileSystemLoader is mentioned in the Loaders API as the preferred way to load templates from the file system.

@davidism
Copy link
Member

davidism commented Oct 18, 2019

I think it's preferable to load templates relative to the project they live in. You give it the name of your package or module, create a templates folder, and you're done.

FileSystemLoader comes with its own set of behaviors. If you specify relative paths, it's dependent on the current working directory when the project is run. If you specify absolute paths, you need to do stuff with os.path and __file__ to make them absolute relative to the project, in which case you might as well use PackageLoader.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 13, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

4 participants