Project Templates with Cookiecutter

When we start new projects we want to solve a problem, not write boilerplate. Cookiecutter helps you to stop writing boilerplate. In this video you will learn what cookiecutter is, and how to create templates so you can save yourself time and effort starting new projects.
Download HD Version next video: Install Node Inside Your Virtualenv

resources cookiecutter docs

pip install cookiecutter
cookiecutter https://github.com/audreyr/cookiecutter-pypackage.git

template1/cookiecutter.json

{
    "repo_name": "reponame",
    "full_name": "Buddy Lindsey",
    "config": "wasup"
}

mkdir template1/{{cookiecutter.repo_name}} vim template1/{{cookiecutter.repo_name}}/file.txt

Name: {{cookiecutter.full_name}}
Email: {{cookiecutter.email}}
Config: {{cookiecutter.config}}
cookiecutter template1/
mkdir template2/
vim template2/cookiecutter.json

template2/cookiecutter.json

{
    "project_name": "project_name is the title of the project.",
    "repo_name":"repo_name is used for describing the directory structure.",
    "author_name": "Your Name",
    "email": "Your email",
    "description": "A short description of the project.",
}
django-admin.py startproject demoproj

edit the following files demoproj/settings.py demoproj/urls.py demoproj/wsgi.py manage.py

{{cookiecutter.repo_name}}
mv demoproj/ {{cookiecutter.repo_name}}
mv {{cookiecutter.repo_name}}/demoproj {{cookiecutter.repo_name}}/{{cookiecutter.repo_name}}
cd ..
cookiecutter template2/
comments powered by Disqus