twoscoops / django-twoscoops-project

The sample project layout from the book, "Two Scoops of Django 1.5 and 1.6"
http://twoscoopspress.org
MIT License
873 stars 343 forks source link

Correct way to develop a new Project template #102

Closed mukgupta closed 9 years ago

mukgupta commented 10 years ago

Hi, First of all thanks for this amazing project. I recently forked this repo and wanted to add some functionality of my own. I want to know what is the correct way to develop and test a new template. What will be the dev environment setup like?. What i can think of currently is making changes to the template and then creating a new project using the template using django-admin startproject --template TEMPLATE_PATH and then test it. Is this the recommended approach?

pydanny commented 10 years ago

For working on a template like this I recommend using virtualenv to manage dependencies. After that, working on the template is a matter of:

  1. Forking the project.
  2. Doing repeated builds until you get what you want.

Unfortunately, because django-admin.py's startproject is so limited in functionality, there is no realistic way to automate the process of template creation. Especially if you are factoring testing of the project once it's created. This makes it a manual effort, and can admittedly get tedious.

There is a solution, but it's outside of Django. Two Scoops of Django co-author Audrey Roy has created a library called cookiecutter which does what startproject does, but also much more. Because it has a easily extendable internal API, it's possible to automate the process of testing Django project templates. I don't have any examples of it being used this way that I can show you, but I know others are claiming they are using it that way.