Created
July 19, 2017 15:50
-
-
Save pizzapanther/edcecdd4ff69ff75c95b038f0648d962 to your computer and use it in GitHub Desktop.
finds all my templates and bundles them up
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def tpl_files (): | |
| tpls = [] | |
| base_dir = os.path.join(settings.BASE_DIR, 'static', 'nac') | |
| for root, dirs, files in os.walk(base_dir): | |
| for file in files: | |
| if file.endswith('.html'): | |
| fullpath = os.path.join(root, file) | |
| relpath = fullpath.replace(base_dir + '/', '').replace('/', '-') | |
| relpath = relpath[:-5] | |
| with open(fullpath, 'r') as fh: | |
| tpls.append({'path': relpath, 'content': fh.read()}) | |
| return tpls |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment