使用 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

有關專案生成選項的更多詳細資訊,請參閱官方文件。 該專案現已設定完畢。