Site icon Nuventure Blog

Django Cookie Cutter

Wondering which is the best way to structure your Django project? The Django Cookie Cutter frameworks help one create a project with a great structure quite easily. The startproject command initializes the directory structure and required files for a standard Django project, which may be fine for learning Django, but not good to be used in production. This is where Cookiecutter exerts its power. The Cookiecutter takes care of a lot of standard tasks like installing the software dependencies, setting up testing files, and including organizing common libraries like Bootstrap and AngularJS, also generating a software license and the README file.

Cookie Cutter provides various features like:

They also provide bonus features like:

Getting Started

    There are few prerequisites to be followed for installing cookiecutter. They are:

First, we need to create a virtualenv for your project and activate it:

$ mkvirtualenv <virtualenv name>
$ workon <virtualenv name>

Now, we can install Cookiecutter by running the command:

$ pip install cookiecutter

Switch to the directory where you want your project to be. Now, execute the following command to generate the django project:

$ cookiecutter https://github.com/pydanny/cookiecutter-django.git

The cookiecutter runs with the cookiecutter-django repo, asking us to enter project-specific details and thus, creating the project. Optional features are asked. We could install them if needed.

That’s it! Let’s build some awesome well structured Django applications with the cookie Cutter framework.

Exit mobile version