Learn best practices from cookiecutter-django

Introduction

This article is the 7th day of Django Advent Calendar 2016.

What to do here

What is cookie cutter

https://github.com/audreyr/cookiecutter

A command-line utility that creates projects from cookiecutters (project templates). E.g. Python package projects, jQuery plugin projects.

CLI tool for creating Python project templates

$ pip install cookiecutter
$ cookiecutter [repository]

What is cookiecutter-django?

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

Configuration options

Project Generation Options — Cookiecutter Django 2016.49.3 documentation

Cloning into 'cookiecutter-django'...
remote: Counting objects: 550, done.
remote: Compressing objects: 100% (310/310), done.
remote: Total 550 (delta 283), reused 479 (delta 222)
Receiving objects: 100% (550/550), 127.66 KiB | 58 KiB/s, done.
Resolving deltas: 100% (283/283), done.
project_name [Project Name]: Reddit Clone
project_slug [reddit_clone]: reddit
author_name [Daniel Roy Greenfeld]: Daniel Greenfeld
email [[email protected]]: [email protected]
description [A short description of the project.]: A reddit clone.
domain_name [example.com]: myreddit.com
version [0.1.0]: 0.0.1
timezone [UTC]: America/Los_Angeles
use_whitenoise [y]: n
use_celery [n]: y
use_mailhog [n]: n
use_sentry_for_error_reporting [y]: y
use_opbeat [n]: y
use_pycharm [n]: y
windows [n]: n
use_python3 [y]: y
use_docker [y]: n
use_heroku [n]: y
use_compressor [n]: y
Select postgresql_version:
1 - 9.5
2 - 9.4
3 - 9.3
4 - 9.2
Choose from 1, 2, 3, 4 [1]: 1
Select js_task_runner:
1 - Gulp
2 - Grunt
3 - Webpack
4 - None
Choose from 1, 2, 3, 4 [1]: 1
use_lets_encrypt [n]: n
Select open_source_license:
1 - MIT
2 - BSD
3 - GPLv3
4 - Apache Software License 2.0
5 - Not open source
Choose from 1, 2, 3, 4, 5 [1]: 1
use_elasticbeanstalk_experimental: n

Features

Optional Integrations

Package introduction

Service that can be linked

Directory structure

~
├── compose
│   ├── django
│   │   ├── Dockerfile
│   │   ├── Dockerfile-dev
│   │   ├── entrypoint.sh
│   │   ├── gunicorn.sh
│   │   └── start-dev.sh
│   ├── nginx
│   │   ├── Dockerfile
│   │   └── nginx.conf
│   └── postgres
│       ├── Dockerfile
│       ├── backup.sh
│       ├── list-backups.sh
│       └── restore.sh
~
├── config
│   ├── __init__.py
│   ├── settings
│   │   ├── __init__.py
│   │   ├── common.py
│   │   ├── local.py
│   │   ├── production.py
│   │   └── test.py
│   ├── urls.py
│   └── wsgi.py
~
├── requirements
│   ├── base.txt
│   ├── local.txt
│   ├── production.txt
│   └── test.txt

I think this area will be helpful. For other configurations, actually create a project and check it.

in conclusion

I've briefly described cookiecutter-django. I think you'll get some insight into developing with Django, so feel free to touch it!

By the way, in Django development, if you check Awesome Django, you will find something new.

Recommended Posts

Learn best practices from cookiecutter-django
Reinforcement learning Learn from today
__version__ traps and best practices
Programming to learn from books May 10
Programming to learn from books May 7
Learn from the winning code-Mercari Competition ①-
AWS Lambda Development My Best Practices
Configuration file best practices in Flask