DEV Community

Cover image for Why you should use  Cookiecutter in you next Django Project.
YusufAdel
YusufAdel

Posted on

Why you should use Cookiecutter in you next Django Project.

What is 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.

Features

  • Cross-platform: Windows, Mac, and Linux are officially supported.

  • You don’t have to know/write Python code to use Cookiecutter

  • Works with Python 2.7, 3.5, 3.6, 3.7, 3.8 ,PyPy and PyPy3.

  • Project templates can be in any programming language or markup format:
    Python, JavaScript, Ruby, CoffeeScript, RST, Markdown, CSS, HTML, you name it.

  • You can use multiple languages in the same project template.
    Simple command line usage:

Install cookiecutter

pip install --user cookiecutter
Enter fullscreen mode Exit fullscreen mode

or you can use any package manager

Usage

First, clone a Cookiecutter project template:

$ git clone git@github.com:audreyr/cookiecutter-pypackage.git
Enter fullscreen mode Exit fullscreen mode

Make your changes

Modify the variables defined in cookiecutter.json.

Open up the skeleton project. If you need to change it around a bit, do so.

You probably also want to create a repo, name it differently, and push it as your own new Cookiecutter project template, for handy future use.

Generate your project

Then generate your project from the project template:

$ cookiecutter cookiecutter-pypackage/
Enter fullscreen mode Exit fullscreen mode

and thats is it, your are ready to go.

reference

Documentation: https://cookiecutter.readthedocs.io
GitHub: https://github.com/cookiecutter/cookiecutter
PyPI: https://pypi.python.org/pypi/cookiecutter

Latest comments (1)

Collapse
 
sm0ke profile image
Sm0ke • Edited

Great tool indeed. Copier is also really nice.
Lately I'm playing with both πŸš€πŸš€