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

Specifying the search path for FileSystemLoader #55

Open
ahmetb opened this issue Aug 17, 2018 · 3 comments
Open

Specifying the search path for FileSystemLoader #55

ahmetb opened this issue Aug 17, 2018 · 3 comments

Comments

@ahmetb
Copy link

ahmetb commented Aug 17, 2018

I have this directory structure on current workdir:

.
└── service
    ├── base.yaml
    ├── external
    │   └── base.yaml
    └── internal
        └── base.yaml

The ./service/internal/base.yaml has a {% extends "./service/base.yaml" %} which works correctly if I run the jinja2 module manually with:

from jinja2 import Environment, FileSystemLoader, select_autoescape
env = Environment(loader=FileSystemLoader('.'))
env.get_template('service/internal/base.yaml').render()

But running jinja2 CLI fails:

$ jinja2 service/external/base.yaml
...
jinja2.exceptions.TemplateNotFound: service/base.yaml

I think jinja2 tool needs to use the current workdir ($CWD) as the search directory (or have a --flag to signal a /path/to/templates).

@mattrobenolt
Copy link
Owner

Hmm, seems like it would be an easy fix. I can try to whip something up, but if in the meantime you wanted to submit a fix, I'd happily review and merge it.

@ahmetb
Copy link
Author

ahmetb commented Aug 20, 2018

I'm pretty bad at python so I'll defer to you :)

@mattrobenolt
Copy link
Owner

meh, that's not a right fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants