Questions tagged [cookiecutter]

A command-line utility that creates projects from cookiecutters (project templates), e.g. creating a Python package project from a Python package project template.

A command-line utility that creates projects from cookiecutters (project templates), e.g. creating a Python package project from a Python package project template.

enter image description here

Project home.

132 questions
20
votes
4 answers

django.db.utils.ProgrammingError: relation "bot_trade" does not exist

I am attempting to set up a website on cookeicutter, I created a new app called "bots" and added a class called Trade within models that lists 2 parameters, "titles" and "units". After migrating and running the server, when I open the admin panel…
Dominic M.
  • 873
  • 3
  • 17
  • 34
14
votes
2 answers

How to protect some files from the Jinja template processor?

I am using cookiecutter to create a tornado project, using this template (it has several bugs, so you'll probably won't be able to use it out of the box). I have hit a problem which I do not know how to solve: jinja2.exceptions.TemplateSyntaxError:…
blueFast
  • 41,341
  • 63
  • 198
  • 344
14
votes
2 answers

Bad Request (400) using Django, Heroku, and Name.com

I just deployed my Django site with Heroku and it works at example.herokuapp.com just fine. The problem I'm having is when I go to example.com, I get Bad Request (400). I've looked at the Django documentation about 400 errors and I can't seem to…
Brian Head
  • 293
  • 4
  • 16
12
votes
3 answers

Can I make a file optional based on a variable's value in cookiecutter.json

I would like to have a file that is optionally added in my python cookiecutter project. An example would be in cookiecutter.json have the variable {"settings_file": true} which would create a file settings.py at the root of my directory (with maybe…
nichochar
  • 2,720
  • 1
  • 18
  • 16
11
votes
1 answer

How to access Postgres database within docker-compose

I'm pretty new to Postgres and Docker, but I am building a webapp with Django that runs inside a docker with a postgresql database. I am trying to view my Postgres database via the command prompt or pgweb. Unfortunately, I can't seem to find the…
Dominic M.
  • 873
  • 3
  • 17
  • 34
11
votes
2 answers

How to use machine-generated variables in cookiecutter

Is there a way to machine-generate some values, after the user has supplied some their values for the variables in cookiecutter.json? The reason I ask is that: one of the values I need to prompt for is rather hard for users to work out but it's…
Clare Macrae
  • 3,670
  • 2
  • 31
  • 45
11
votes
1 answer

How to tell cookiecutter to download a stable version of cookiecutter-django?

The command: cookiecutter https://github.com/pydanny/cookiecutter-django/ will clone the lastest version of cookiecutter-django, which is aimed for Django 1.9. There is a Stable section in the README pointing to some tags. One of them being…
jgomo3
  • 1,153
  • 1
  • 13
  • 26
10
votes
1 answer

cookie cutter: what's the easiest way to specify variables for the prompts

Is there anything that offers replay-type functionality, by pointing at a predefined prompt-answer file? What works and what I'd like to achieve. Let's take an example, using a cookiecutter to prep a Python package for pypi cookiecutter…
JL Peyret
  • 10,917
  • 2
  • 54
  • 73
10
votes
1 answer

Automated testing for cookiecutters

cookiecutters are template generators that are massively useful in generating projects in a range of languages. However, I was wondering if there's a way to consistently test them? I want to generate not only the final product (make assertions about…
Chris vCB
  • 1,023
  • 3
  • 13
  • 28
10
votes
3 answers

Locating Cookiecutter Extensions

I'm working on creating my first cookiecutter. By and large, this has gone well, but I now want to add a jinja2 filter of my own. In line with the comments in this issue, I've created a new Jinja2 extension much like the one here. Full code for this…
Saff
  • 501
  • 3
  • 13
7
votes
2 answers

Fresh cookiecutter django project shows "Invalid syntax" at environ.py

I started my first project with cookiecutter using the cookiecutter-django template. When I tried to start it from PyCharm using the virtualenv, it gave me an error in a lib file: environ.py, telling me this: File…
madtyn
  • 1,469
  • 27
  • 55
7
votes
1 answer

Cookiecutter created directory giving me issues running development server and python shell

I created a django project using cookiecutter as reccomended by Two scoops of Django 1.8. It's called icecreamratings_project I use the git cmd prompt and use 'cd icecreamratings_project'. When i want to use the built-in python interpreter by…
Armando Xhimanki
  • 115
  • 1
  • 11
7
votes
0 answers

How to add a custom filter for use in a cookiecutter template?

how can I add a custom filter to be used in a jinja template used by cookiecutter? I tried adding using a pre_gen_project hook, it's called, but I can't find a way to make my python functions visible as jinja filters (or function) inside the…
José Ricardo
  • 1,479
  • 1
  • 14
  • 28
6
votes
1 answer

How to use dynamic variables in cookiecutter hooks?

I would like to use dynamic variables inside hooks/pre_gen_project.py. When I add a static text inside the hook file it works: {{ cookiecutter.update({"venv_path": "static/venvpath", "py_path": "static/pypath"}) }} But when I tried to use a…
emrec
  • 65
  • 1
  • 4
6
votes
0 answers

python cookiecutter : Is there a way to make an input variable mandatory in cookiecutter?

I have a cookiecuttern json like below { "variable1": "Test variable 1 - mandatory", "variable2": "Test variable 2" } Is there any way to specify to the user of this cookiecuter that this field variable1 is mandatory? I dont want the user…
rohit2219
  • 218
  • 2
  • 12
1
2 3
8 9