Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Django Cookiecutter short walk

Django Cookiecutter short walk

It's a lightning walk showing cookiecutter-django.

More detail in doc:
Cookiecutter https://cookiecutter.readthedocs.io/
Cookiecutter Django https://cookiecutter-django.readthedocs.io/

D1804d3c315cbb850aaa88d2fbadc3cf?s=128

Keith Yang

June 18, 2020
Tweet

Transcript

  1. Cookiecutter Django Keith Yang @ Taipei.py 2020 June 新專案⼀直⼀直來?不斷地在造輪⼦?

  2. Agenda 順利的話 1. What is Cookiecutter 2. Demo 3. What

    then Cookiecutter-Django features 4. Demo
  3. Cookiecutter Created by Audrey Roy A command-line utility that creates

    projects from cookiecutters (project templates), e.g. creating a Python package project from a Python package project template. https:!//github.com/cookiecutter/cookiecutter
  4. Features of Cookiecutter 有⼈的常⾒需求,想必你也可有需要 • Cross-platform: Windows, Mac, and Linux

    are officially supported. • You don't have to know/write Python code to use Cookiecutter • Works with Python 3.6, 3.7, 3.8 and PyPy3. (2… • Project templates can be in any programming language or markup format: Python, JavaScript, Ruby, CoffeeScript, RST, Markdown, CSS, HTML, you name it. You can use multiple languages in the same project template. • Simple command line usage:
  5. Sample run • 不過⾸先當然 pip install --user cookiecutter • 然後就挑⼀個

    GitHub 上的 repo 跑跑看 cookiecutter gh:audreyr/ cookiecutter-pypackage 它會問你⼀些問題,回答它啊
  6. What have it done? • ⼀切都基於 repo 上的 template 所

    gen 看⼀下它產⽣的東⻄
  7. Cookiecutter Django Created by Daniel Feldroy FEATURES …

  8. • For Django 3.0 • Works with Python 3.8 •

    Renders Django projects with 100% starting test coverage • Twitter Bootstrap v4 (maintained Foundation fork also available) • 12-Factor based settings via django-environ • Secure by default. We believe in SSL. • Optimized development and production settings • Registration via django-allauth • Comes with custom user model ready to go • Optional basic ASGI setup for Websockets • Optional custom static build using Gulp and livereload • Send emails via Anymail (using Mailgun by default or Amazon SES if AWS is selected cloud provider, but switchable) • Media storage using Amazon S3 or Google Cloud Storage • Docker support using docker-compose for development and production (using Traefik with LetsEncrypt support) • Procfile for deploying to Heroku • Instructions for deploying to PythonAnywhere • Run tests with unittest or pytest • Customizable PostgreSQL version • Default integration with pre-commit for identifying simple issues before submission to code review
  9. Cookiecutter-Django features - part 1 • For Django 3.0 •

    Works with Python 3.8 • Renders Django projects with 100% starting test coverage • Twitter Bootstrap v4 (maintained Foundation fork also available)
  10. Cookiecutter-Django features - part 2 • 12-Factor based settings via

    django-environ • Secure by default. We believe in SSL. • Registration via django-allauth • Comes with custom user model ready to go • Optional basic ASGI setup for Websockets
  11. Cookiecutter-Django features - part 3 • Send emails via Anymail

    (using Mailgun by default or Amazon SES if AWS is selected cloud provider, but switchable) • Media storage using Amazon S3 or Google Cloud Storage • Docker support using docker-compose for development and production (using Traefik with LetsEncrypt support)
  12. Cookiecutter-Django features - part 4 • Procfile for deploying to

    Heroku • Instructions for deploying to PythonAnywhere • Run tests with unittest or pytest • Customizable PostgreSQL version
  13. Cookiecutter-Django features - more • Django Rest Framework (drf) support

    • Django compressor • Celery • Sentry
  14. 跑跑看 • cookiecutter gh:pydanny/ cookiecutter-django

  15. 最後 demo ⼀下 … ls

  16. Do it yourself! ⾃⼰改個 cookiecutter 來重複使⽤吧