使用 Cookiecutter 安装和设置 django 项目

以下是安装 Cookiecutter 的先决条件:

  • 果仁
  • virtualenv
  • PostgreSQL 的

为你的项目创建 virtualenv 并激活它:

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

现在使用以下命令安装 Cookiecutter:

$ pip install cookiecutter

将目录更改为你希望项目所在的文件夹。现在执行以下命令来生成 django 项目:

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

此命令使用 cookiecutter-django repo 运行 cookiecutter,要求我们输入项目特定的详细信息。按输入而不键入任何内容以使用默认值,这些值在问题后面的[方括号]中显示。

project_name [project_name]: example_project
repo_name [example_project]: 
author_name [Your Name]: Atul Mishra
email [Your email]: abc@gmail.com
description [A short description of the project.]: Demo Project
domain_name [example.com]: example.com
version [0.1.0]: 0.1.0
timezone [UTC]: UTC
now [2016/03/08]: 2016/03/08
year [2016]: 2016
use_whitenoise [y]: y
use_celery [n]: n
use_mailhog [n]: n
use_sentry [n]: n
use_newrelic [n]: n
use_opbeat [n]: n
windows [n]: n
use_python2 [n]: n

有关项目生成选项的更多详细信息,请参阅官方文档。 该项目现已设置完毕。