Skip to content

Instantly share code, notes, and snippets.

@geoffreyvanwyk
Created August 14, 2023 09:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save geoffreyvanwyk/8971c30710ca98ecc48ec4295735b6f0 to your computer and use it in GitHub Desktop.
Save geoffreyvanwyk/8971c30710ca98ecc48ec4295735b6f0 to your computer and use it in GitHub Desktop.
Remove Jinja file extension after creating project from Cookiecutter
# Create a "hooks" directory at the root of your Cookiecutter project, then add this file to it.
import os
for path, subdirs, files in os.walk("."):
for name in files:
if name.endswith(".j2"):
os.rename(os.path.join(path, name), os.path.join(path, name.rstrip(".j2")))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment