4

I have been building a project on top of cookiecutter django (https://github.com/pydanny/cookiecutter-django), with Celery turned off in the cookiecutter generation settings. However, now I'm finding I need Celery. Is there a way I can flip a config, turn Celery on, and re-generate boilerplate in this current project?

Otherwise, what I plan to do is create a new cookiecutter project with the new settings and then inspect files and differences and import changes by hand (which is tedious and potentially imperfect).

Any alternatives/improvements to this manual method would work as an answer for this question.

personjerry
  • 1,045
  • 8
  • 28
  • Any updates to this? I had a little bit of trouble understanding how to update a running production docker in EC2, but I'll give an opinion that might not necessarily work. Create a new cookiecutter-django project and see what is added to the docker files and python files. Add that in to your current project, rsync it with EC2 or whatever you are using, and rebuild the docker containers with `docker-compose -f local.yml (or production.yml) up --build` – Yoomama Jan 15 '20 at 03:44
  • I need this as well: i want a templating system that can update or at least compare existing projects (or, in my case, single files). See [this discussion about using markdown templates](https://discourse.gohugo.io/t/using-and-maintaining-markdown-templates/31020) in Hugo. – anarcat Feb 03 '21 at 16:37

2 Answers2

1

What I ended up doing is running cookiecutter with all my current settings, then running it again with the same settings except celery turned on, then git diff the two folders and step through the diff manually to apply the appropriate changes.

personjerry
  • 1,045
  • 8
  • 28
0

CookieCutter is not so much of a blackbox!

I had the same issue as personjerry. And I felt uncomfortable because CookieCutter-Django seemed complicated at first. And thus every developer has tendency to go with most options on or most options off.

But it's actually not that complicated.

How each config parameter affects the generated codebase can be easily found out by searching the CookieCutter-Django codebase with keyword cookiecutter.{{parameter_name}} For example, searching the codebase with cookiecutter.use_celery reveals how the generated code is affected by your choice on use_celery

Parameter effect can be categorized into

  • remove unnecessary files, if I'm not choosing the option.
  • add or skip code lines

This kind of experience may give you more confidence on using CookieCutter-Django.

Hope this answer help those who love CookieCutter-Django and Django

Amartis Glady
  • 181
  • 1
  • 2