Published on

Django project generation using cookiecutter-django

Authors

Cookiecutter is a command line utility to create projects from templates. cookiecutter-django is a production ready django template to help jumpstart a project.

The advantage to using this you can have your team follow the same template and this will make sure there is a level of uniformity in your organisation

For list of features, dependencies please visit github repo

Project Generation

  • Install cookiecutter
pip install cookiecutter
  • RUN COOKIECUTTER COMMAND LINE TO SETUP DJANGO PROJECT
cookiecutter gh:pydanny/cookiecutter-django
  • WHEN PROMPTED TYPE YES OR LEAVE IT BLANK TO REPLACE ALREADY DOWNLOADED TEMPLATE
You’ve downloaded ~user/.cookiecutters/cookiecutter-django before. Is it okay to delete and re-download it? [yes]:
  • ANSWER SETUP RELATED QUESTIONS TO FINALISE
project_name [My Awesome Project]: Sample Django Project
project_slug [sample_django_project]: my_first_django_project
description [Behold My Awesome Project!]: My First Django Project
author_name [Daniel Roy Greenfeld]: Manas Mallick
domain_name [example.com]: mycodehere.com
email [manas-mallick@example.com]: manas@mycodehere.com
version [0.1.0]: 0.0.1
  • Next set of questions are more to choose project type, features, licenses
Select open_source_license:
1MIT
2BSD
3GPLv3
4Apache Software License 2.0
5Not open source
Choose from 1, 2, 3, 4, 5 [1]: 1
  • Your timezone (if you miss this you could change in config/settings later)
timezone [UTC]: UTC
  • Whether your runtime is in windows
windows [n]: n
  • Whether you use pycharm
use_pycharm [n]: n
  • Whether you use docker
use_docker [n]: n
  • What version of postgres would you use
Select postgresql_version:
111.3
210.8
39.6
49.5
59.4
Choose from 1, 2, 3, 4, 5 [1]: 1
  • What task runner to use to automate JavaScript or CSS compilation from TypeScript or SGSS
Select js_task_runner:
1None
2Gulp
Choose from 1, 2 [1]: 1
  • Cloud provider (also used to server static files) *
Select cloud_provider:
1AWS
2GCP
3None
Choose from 1, 2, 3 [1]: 3
  • Mail service to send emails
Select mail_service:
1Mailgun
2Amazon SES
3Mailjet
4Mandrill
5Postmark
6Sendgrid
7SendinBlue
8SparkPost
9Other SMTP
Choose from 1, 2, 3, 4, 5, 6, 7, 8, 9 [1]: 1
  • Whether you want to use asynchronous execution (select y only if you know what you are doing)
use_async [n]: n
  • Whether you want to use Django Rest Framework for WebAPI
use_drf [n]: n
  • Whether you would use custom bootstrap styles
custom_bootstrap_compilation [n]: n
  • To compress linked and inline JS or CSS into single cached file
use_compressor [n]: n
  • Whether you require task queue, this also supports scheduling and messaging
use_celery [n]: y
  • Email Testing tool for developers
use_mailhog [n]: y
  • To perform error tracking (aggregates errors by details)
use_sentry [n]: y
  • Whether you would use whitenoise to serve static files *
use_whitenoise [n]: n
  • Cloud hosting platform
use_heroku [n]: n
  • Whether you would use Continuous Integration
Select ci_tool:
1None
2Travis
3Gitlab
Choose from 1, 2, 3 [1]: 3
  • Whether you would like to store local settings in version control system
keep_local_envs_in_vcs [y]: y
  • Debug only or production
debug [n]: y

You should either use Whitenoise or select a Cloud Provider to serve static files

  • PREPARE WORKSPACE AND RUNSERVER

REFERENCES: