from jinja2 import Environment, FileSystemLoader import config import os # Static Variables templates_directory = 'src/templates' # Load Templates Directory file_loader = FileSystemLoader(templates_directory) env = Environment(loader=file_loader) # Template everyfile def template(filename, target_path): # Load Template template = env.get_template(filename) # Render Output content = template.render(db=config.db) # Write Template to file filename_without_ext = os.path.splitext(filename)[0] cooked_file = target_path+filename_without_ext file = open(cooked_file, 'w') file.write(content) file.close() # Render the templates: ## Create Docker-Compose template("docker-compose.yml.j2", "./src/")