question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

NonTemplatedInputDirException on template with static file names.

See original GitHub issue
  • Cookiecutter version: 1.6.0
  • Python version: 2.7
  • Operating System: macOS High Sierra

Description:

I’m trying to generate a template that creates a couple of test files for my project.

my-template/
--- cookiecutter.json
--- resolvers.test.js
--- test-fixtures.js

What I’ve run:

// Inside dir where I want to create the test files.
cookiecutter /path/to/my-template

I get cookiecutter.exceptions.NonTemplatedInputDirException

Traceback (most recent call last):
  File "/usr/local/bin/cookiecutter", line 11, in <module>
    load_entry_point('cookiecutter==1.6.0', 'console_scripts', 'cookiecutter')()
  File "/usr/local/Cellar/cookiecutter/1.6.0/libexec/lib/python2.7/site-packages/click/core.py", line 722, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/Cellar/cookiecutter/1.6.0/libexec/lib/python2.7/site-packages/click/core.py", line 697, in main
    rv = self.invoke(ctx)
  File "/usr/local/Cellar/cookiecutter/1.6.0/libexec/lib/python2.7/site-packages/click/core.py", line 895, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/Cellar/cookiecutter/1.6.0/libexec/lib/python2.7/site-packages/click/core.py", line 535, in invoke
    return callback(*args, **kwargs)
  File "/usr/local/Cellar/cookiecutter/1.6.0/libexec/lib/python2.7/site-packages/cookiecutter/cli.py", line 120, in main
    password=os.environ.get('COOKIECUTTER_REPO_PASSWORD')
  File "/usr/local/Cellar/cookiecutter/1.6.0/libexec/lib/python2.7/site-packages/cookiecutter/main.py", line 94, in cookiecutter
    output_dir=output_dir
  File "/usr/local/Cellar/cookiecutter/1.6.0/libexec/lib/python2.7/site-packages/cookiecutter/generate.py", line 257, in generate_files
    template_dir = find_template(repo_dir)
  File "/usr/local/Cellar/cookiecutter/1.6.0/libexec/lib/python2.7/site-packages/cookiecutter/find.py", line 36, in find_template
    raise NonTemplatedInputDirException
cookiecutter.exceptions.NonTemplatedInputDirException

I believe this is because none of my template files use variables in their names, e.g. {{cookiecutter.modelName}}-resolvers.test.js is there a way to skip that requirement?

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:10
  • Comments:10 (2 by maintainers)

github_iconTop GitHub Comments

39reactions
indrifcommented, Dec 17, 2019

But wait what? So I have to use a templated root dir? What if I want cookiecutter to create a templated dir inside an existing dir, such as A/b/{{cookiecutter.slug_name}}? Is that really something that breaks the initial vision you mentioned earlier?

Or perhaps you just want to create some templated files inside an existing folder. Why is there a requirement for every folder to be templated?

21reactions
pydannycommented, Jul 18, 2018

Apologies, but you are asking for a proven feature of Cookiecutter to be removed.

The design of Cookiecutter is for the template to have a top level directory to have template configuration files. For example, this means you can use continuous integration and pytest-cookies to confirm your project template isn’t broken on a change. Reference Cookiecutter Django’s root directory, including tests, travis-ci.yml, tox.ini, and others to see how this works in a real-world project.

So allowing top level files to be included in a generated template just isn’t going to happen. It breaks the original architecture envisioned by @audreyr. Instead, you need to create a {{cookiecutter.project_slug}} or other similarly named directory for your project.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Variable static file names in Django - Stack Overflow
I don't want to update all of the template files manually to the new file name. Is there any shortcut that I can...
Read more >
Advanced Usage — staticjinja 4.1.3 documentation
This document covers some of staticjinja's more advanced features. Partials and ignored files¶. A partial file is a file whose name begins with...
Read more >
Working with Django Templates & Static Files - DigitalOcean
In this tutorial, I will show you how to add some CSS and JavaScript to your Django templates in order to make them...
Read more >
Directory Structure - Hugo
Stores templates in the form of .html files that specify how views of your content will be rendered into a static website. Templates...
Read more >
Writing templates — Wagtail 1.7 documentation
The name of the template file can be overridden per model if necessary. ... Static files e.g CSS, JS and images are typically...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found