merge conflict after upstream pull

This commit is contained in:
Srinivas Nyayapati 2016-09-12 21:48:48 -04:00
commit 5bec0dc45c
92 changed files with 2474 additions and 811 deletions

1
.gitignore vendored
View File

@ -25,6 +25,7 @@ sftp-config.json
*.pyc *.pyc
.idea .idea
_build _build
*.egg-info/
# Project Specific Stuff # Project Specific Stuff
local_settings.py local_settings.py

View File

@ -15,12 +15,17 @@ env:
- TOX_ENV=py35 - TOX_ENV=py35
before_install: before_install:
- sudo sh -c 'echo "deb https://apt.dockerproject.org/repo ubuntu-precise main" > /etc/apt/sources.list.d/docker.list'
- sudo apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D
- sudo apt-get update - sudo apt-get update
- sudo apt-get install -y -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" docker-engine=1.10.1-0~trusty - sudo apt-key update
- sudo apt-get --force-yes -qqy -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" install docker-engine=1.11.1-0~precise
- sudo rm /usr/local/bin/docker-compose - sudo rm /usr/local/bin/docker-compose
- curl -L https://github.com/docker/compose/releases/download/1.6.0/docker-compose-`uname -s`-`uname -m` > docker-compose - curl -L https://github.com/docker/compose/releases/download/1.7.0/docker-compose-`uname -s`-`uname -m` > docker-compose
- chmod +x docker-compose - chmod +x docker-compose
- sudo mv docker-compose /usr/local/bin - sudo mv docker-compose /usr/local/bin
- docker-compose -v
- docker -v
script: script:
- tox -e $TOX_ENV - tox -e $TOX_ENV

View File

@ -2,6 +2,93 @@
All enhancements and patches to Cookiecutter Django will be documented in this file. All enhancements and patches to Cookiecutter Django will be documented in this file.
This project adheres to [Semantic Versioning](http://semver.org/). This project adheres to [Semantic Versioning](http://semver.org/).
##[2016-09-10]
### Changed
- Use app registry instead of INSTALLED_APPS to discover celery tasks (@dhepper)
- PEP8 imports fix (@aleprovencio)
### Removed
- Removed django-floppyforms (@pydanny)
##[2016-09-08]
### Removed
- Webpack support, see #774 (@ssteinerx)
##[2016-08-10]
## Added
- PostgreSQL versions are now selectable, instead of defaulting to 9.5; the minimum version is 9.2, which is supported by [Heroku](https://devcenter.heroku.com/articles/heroku-postgresql#version-support-and-legacy-infrastructure) and Django (@burhan)
- Fixed minor issue in the README.rst (@burhan)
##[2016-08-03]
## Changed
- Upgrade to Bootstrap 4 Alpha 3 and its dependencies, including jQuery (@audreyr)
##[2016-06-25]
## Changed
- use `https` instead `ssh` to clone [cookiecutter-webpack](https://github.com/hzdg/cookiecutter-webpack) if `Webpack` is selected as `JS Task Runner` - fix issue #647 (@luzfcb and @resakse)
##[2016-06-24]
## Added
- Settings file for running tests faster (@audreyr)
- Add GPLv3 licence support (@cgaspoz)
## Changed
- Makes the database backups compressed. restores compressed backups (@jangeador)
- Review and edit django-allauth templates (@kappataumu)
##[2016-06-19]
## Added
- Webpack as an option (@goldhand)
##[2016-06-17]
## Added
- django-compressor support (@andresgz)
- Debian Jessie OS Requirements (@ddiazpinto)
##[2016-06-14]
### Changed
- Move Docker backups to their own section (@pydanny)
##[2016-06-13]
### Changed
- Use latest redis image in Docker (@pydanny)
- Documentation cleanup and corrections (@audreyr)
##[2016-06-12]
### Changed
- Documentation cleanup and corrections (@kappataumu)
##[2016-06-11]
### Changed
- Enhancements to the developing locally docs (@antoniablair)
##[2016-06-06]
### Changed
- Pin Bootstrap CSS and JS to v4.0.0-alpha.2, use minified versions
##[2016-06-05]
### Added
- Configurable admin for users (@pydanny, @jayfk, @dezoito)
##[2016-06-04]
### Added
- Let's Encrypt automation and instruction (@mjsisley and @chrisdev)
##[2016-06-03]
### Added
- Documentation for debugging with Docker (@mjsisley)
- Apache 2 License option in `cookiecutter.json` (@dot2dotseurat)
- Removed unnecessary version check from `pre_gen_project.py` (@suledev)
- Add gulp alternative as a js task runner and fix navbar style issue (@viviangb and @xpostudio4)
### Deleted
- AngularJS (@pydanny)
- django-secure (@xpostudio4)
##[2016-06-02]
### Added
- Added better instructions for installing postgres on Mac OS X (@dot2dotseurat )
##[2016-05-22] ##[2016-05-22]
### Added ### Added
- Added instructions for copying backups from docker to host (@phiberjenz) - Added instructions for copying backups from docker to host (@phiberjenz)

View File

@ -2,7 +2,7 @@ Contributors
============ ============
Core Developers Core Developers
---------------- ---------------
These contributors have commit flags for the repository, These contributors have commit flags for the repository,
and are able to accept and merge pull requests. and are able to accept and merge pull requests.
@ -28,7 +28,7 @@ Daniel are on the Cookiecutter core team.*
.. _@jayfk: https://github.com/jayfk .. _@jayfk: https://github.com/jayfk
Other Contributors Other Contributors
------------------- ------------------
Listed in alphabetical order. Listed in alphabetical order.
@ -45,9 +45,12 @@ Listed in alphabetical order.
Alex Tsai `@caffodian`_ Alex Tsai `@caffodian`_
Alvaro [Andor] `@andor-pierdelacabeza`_ Alvaro [Andor] `@andor-pierdelacabeza`_
Amjith Ramanujam `@amjith`_ Amjith Ramanujam `@amjith`_
Andreas Meistad `@ameistad`_
Andres Gonzalez `@andresgz`_
Andrew Mikhnevich `@zcho`_ Andrew Mikhnevich `@zcho`_
Andy Rose Andy Rose
Anna Callahan `@jazztpt`_ Anna Callahan `@jazztpt`_
Antonia Blair `@antoniablair`_ @antoniablairart
Areski Belaid `@areski`_ Areski Belaid `@areski`_
Ashley Camba Ashley Camba
Barclay Gauld `@yunti`_ Barclay Gauld `@yunti`_
@ -57,16 +60,21 @@ Listed in alphabetical order.
Bouke Haarsma Bouke Haarsma
Burhan Khalid `@burhan`_ @burhan Burhan Khalid `@burhan`_ @burhan
Catherine Devlin `@catherinedevlin`_ Catherine Devlin `@catherinedevlin`_
Cédric Gaspoz `@cgaspoz`_
Chris Curvey `@ccurvey`_ Chris Curvey `@ccurvey`_
Chris Franklin Chris Franklin
Chris Franklin `@hairychris`_ Chris Franklin `@hairychris`_
Chris Pappalardo `@ChrisPappalardo`_ Chris Pappalardo `@ChrisPappalardo`_
Christopher Clarke `@chrisdev`_
Collederas `@Collederas`_ Collederas `@Collederas`_
Cristian Vargas `@cdvv7788`_ Cristian Vargas `@cdvv7788`_
Cullen Rhodes `@c-rhodes`_ Cullen Rhodes `@c-rhodes`_
Dan Shultz `@shultz`_
Daniel Hepper `@dhepper`_ @danielhepper
Daniele Tricoli `@eriol`_ Daniele Tricoli `@eriol`_
David Díaz `@ddiazpinto`_ @DavidDiazPinto David Díaz `@ddiazpinto`_ @DavidDiazPinto
Davur Clementsen `@dsclementsen`_ @davur Davur Clementsen `@dsclementsen`_ @davur
Delio Castillo `@jangeador`_ @jangeador
Dónal Adams `@epileptic-fish`_ Dónal Adams `@epileptic-fish`_
Dong Huynh `@trungdong`_ Dong Huynh `@trungdong`_
Emanuel Calso `@bloodpet`_ @bloodpet Emanuel Calso `@bloodpet`_ @bloodpet
@ -79,14 +87,17 @@ Listed in alphabetical order.
Henrique G. G. Pereira `@ikkebr`_ Henrique G. G. Pereira `@ikkebr`_
Ian Lee `@IanLee1521`_ Ian Lee `@IanLee1521`_
Jan Van Bruggen `@jvanbrug`_ Jan Van Bruggen `@jvanbrug`_
Jens Nilsson `@phiberjenz` Jens Nilsson `@phiberjenz`_
Julien Almarcha `@sladinji`_
Julio Castillo `@juliocc`_ Julio Castillo `@juliocc`_
Kaido Kert `@kaidokert`_ Kaido Kert `@kaidokert`_
kappataumu `@kappataumu`_ @kappataumu
Kaveh `@ka7eh`_ Kaveh `@ka7eh`_
Kevin A. Stone Kevin A. Stone
Kevin Ndung'u `@kevgathuku`_ Kevin Ndung'u `@kevgathuku`_
Krzysztof Szumny `@noisy`_ Krzysztof Szumny `@noisy`_
Krzysztof Żuraw `@krzysztofzuraw`_ Krzysztof Żuraw `@krzysztofzuraw`_
Leonardo Jimenez `@xpostudio4`_
Lin Xianyi `@iynaix`_ Lin Xianyi `@iynaix`_
Luis Nell `@originell`_ Luis Nell `@originell`_
Lukas Klein Lukas Klein
@ -96,8 +107,12 @@ Listed in alphabetical order.
Matt Linares Matt Linares
Matt Menzenski `@menzenski`_ Matt Menzenski `@menzenski`_
Matt Warren `@mfwarren`_ Matt Warren `@mfwarren`_
Matthew Sisley `@mjsisley`_
Meghan Heintz `@dot2dotseurat`_
mozillazg `@mozillazg`_ mozillazg `@mozillazg`_
Pablo `@oubiga`_ Pablo `@oubiga`_
Parbhat Puri `@parbhat`_
Peter Bittner `@bittner`_
Raphael Pierzina `@hackebrot`_ Raphael Pierzina `@hackebrot`_
Raony Guimarães Corrêa `@raonyguimaraes`_ Raony Guimarães Corrêa `@raonyguimaraes`_
Roman Afanaskin `@siauPatrick`_ Roman Afanaskin `@siauPatrick`_
@ -106,25 +121,32 @@ Listed in alphabetical order.
stepmr `@stepmr`_ stepmr `@stepmr`_
Sławek Ehlert `@slafs`_ Sławek Ehlert `@slafs`_
Srinivas Nyayapati `@shireenrao`_ Srinivas Nyayapati `@shireenrao`_
Steve Steiner `@ssteinerX`_
Sule Marshall `@suledev`_
Taylor Baldwin Taylor Baldwin
Théo Segonds `@show0k`_ Théo Segonds `@show0k`_
Tom Atkins `@knitatoms`_ Tom Atkins `@knitatoms`_
Tom Offermann Tom Offermann
Travis McNeill `@Travistock`_ @tavistock_esq Travis McNeill `@Travistock`_ @tavistock_esq
Vitaly Babiy Vitaly Babiy
Vivian Guillen `@viviangb`_
Will Farley `@goldhand`_ @g01dhand
Yaroslav Halchenko Yaroslav Halchenko
========================== ============================ ============== ========================== ============================ ==============
.. _@dezoito: https://github.com/dezoito
.. _@a7p: https://github.com/a7p .. _@a7p: https://github.com/a7p
.. _@ad-m: https://github.com/ad-m .. _@ad-m: https://github.com/ad-m
.. _@aeikenberry: https://github.com/aeikenberry .. _@aeikenberry: https://github.com/aeikenberry
.. _@alb3rto: https://github.com/alb3rto .. _@alb3rto: https://github.com/alb3rto
.. _@ameistad: https://github.com/ameistad
.. _@amjith: https://github.com/amjith .. _@amjith: https://github.com/amjith
.. _@andor-pierdelacabeza: https://github.com/andor-pierdelacabeza .. _@andor-pierdelacabeza: https://github.com/andor-pierdelacabeza
.. _@antoniablair: https://github.com/antoniablair
.. _@areski: https://github.com/areski .. _@areski: https://github.com/areski
.. _@arruda: https://github.com/arruda .. _@arruda: https://github.com/arruda
.. _@bittner: https://github.com/bittner
.. _@bloodpet: https://github.com/bloodpet .. _@bloodpet: https://github.com/bloodpet
.. _@blopker: https://github.com/blopker
.. _@bogdal: https://github.com/bogdal .. _@bogdal: https://github.com/bogdal
.. _@burhan: https://github.com/burhan .. _@burhan: https://github.com/burhan
.. _@c-rhodes: https://github.com/c-rhodes .. _@c-rhodes: https://github.com/c-rhodes
@ -132,9 +154,14 @@ Listed in alphabetical order.
.. _@catherinedevlin: https://github.com/catherinedevlin .. _@catherinedevlin: https://github.com/catherinedevlin
.. _@ccurvey: https://github.com/ccurvey .. _@ccurvey: https://github.com/ccurvey
.. _@cdvv7788: https://github.com/cdvv7788 .. _@cdvv7788: https://github.com/cdvv7788
.. _@cgaspoz: https://github.com/cgaspoz
.. _@chrisdev: https://github.com/chrisdev
.. _@ChrisPappalardo: https://github.com/ChrisPappalardo .. _@ChrisPappalardo: https://github.com/ChrisPappalardo
.. _@Collederas: https://github.com/Collederas .. _@Collederas: https://github.com/Collederas
.. _@ddiazpinto: https://github.com/ddiazpinto .. _@ddiazpinto: https://github.com/ddiazpinto
.. _@dezoito: https://github.com/dezoito
.. _@dhepper: https://github.com/dhepper
.. _@dot2dotseurat: https://github.com/dot2dotseurat
.. _@dsclementsen: https://github.com/dsclementsen .. _@dsclementsen: https://github.com/dsclementsen
.. _@epileptic-fish: https://gihub.com/epileptic-fish .. _@epileptic-fish: https://gihub.com/epileptic-fish
.. _@eraldo: https://github.com/eraldo .. _@eraldo: https://github.com/eraldo
@ -142,6 +169,7 @@ Listed in alphabetical order.
.. _@eyadsibai: https://github.com/eyadsibai .. _@eyadsibai: https://github.com/eyadsibai
.. _@garry-cairns: https://github.com/garry-cairns .. _@garry-cairns: https://github.com/garry-cairns
.. _@garrypolley: https://github.com/garrypolley .. _@garrypolley: https://github.com/garrypolley
.. _@goldhand: https://github.com/goldhand
.. _@hackebrot: https://github.com/hackebrot .. _@hackebrot: https://github.com/hackebrot
.. _@hairychris: https://github.com/hairychris .. _@hairychris: https://github.com/hairychris
.. _@hjwp: https://github.com/hjwp .. _@hjwp: https://github.com/hjwp
@ -153,26 +181,40 @@ Listed in alphabetical order.
.. _@jvanbrug: https://github.com/jvanbrug .. _@jvanbrug: https://github.com/jvanbrug
.. _@ka7eh: https://github.com/ka7eh .. _@ka7eh: https://github.com/ka7eh
.. _@kaidokert: https://github.com/kaidokert .. _@kaidokert: https://github.com/kaidokert
.. _@kappataumu: https://github.com/kappataumu
.. _@kevgathuku: https://github.com/kevgathuku .. _@kevgathuku: https://github.com/kevgathuku
.. _@knitatoms: https://github.com/knitatoms .. _@knitatoms: https://github.com/knitatoms
.. _@krzysztofzuraw: https://github.com/krzysztofzuraw
.. _@MathijsHoogland: https://github.com/MathijsHoogland .. _@MathijsHoogland: https://github.com/MathijsHoogland
.. _@menzenski: https://github.com/menzenski .. _@menzenski: https://github.com/menzenski
.. _@mfwarren: https://github.com/mfwarren .. _@mfwarren: https://github.com/mfwarren
.. _@mjsisley: https://github.com/mjsisley
.. _@mozillazg: https://github.com/mozillazg .. _@mozillazg: https://github.com/mozillazg
.. _@noisy: https://github.com/noisy
.. _@originell: https://github.com/originell .. _@originell: https://github.com/originell
.. _@oubiga: https://github.com/oubiga .. _@oubiga: https://github.com/oubiga
.. _@romanosipenko: https://github.com/romanosipenko .. _@parbhat: https://github.com/parbhat
.. _@raonyguimaraes: https://github.com/raonyguimaraes .. _@raonyguimaraes: https://github.com/raonyguimaraes
.. _@show0k: https://github.com/show0k .. _@romanosipenko: https://github.com/romanosipenko
.. _@siauPatrick: https://github.com/siauPatrick
.. _@shireenrao: https://github.com/shireenrao .. _@shireenrao: https://github.com/shireenrao
.. _@show0k: https://github.com/show0k
.. _@shultz: https://github.com/shultz
.. _@siauPatrick: https://github.com/siauPatrick
.. _@slafs: https://github.com/slafs .. _@slafs: https://github.com/slafs
.. _@ssteinerX: https://github.com/ssteinerx
.. _@stepmr: https://github.com/stepmr .. _@stepmr: https://github.com/stepmr
.. _@suledev: https://github.com/suledev
.. _@Travistock: https://github.com/Tavistock .. _@Travistock: https://github.com/Tavistock
.. _@trungdong: https://github.com/trungdong .. _@trungdong: https://github.com/trungdong
.. _@viviangb: httpsL//github.com/viviangb
.. _@xpostudio4: https://github.com/xpostudio4
.. _@yunti: https://github.com/yunti .. _@yunti: https://github.com/yunti
.. _@zcho: https://github.com/zcho .. _@zcho: https://github.com/zcho
.. _@noisy: https://github.com/noisy .. _@phiberjenz: https://github.com/phiberjenz
.. _@sladinji: https://github.com/sladinji
.. _@andresgz: https://github.com/andresgz
.. _@jangeador: https://github.com/jangeador
Special Thanks Special Thanks
~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~

View File

@ -1,9 +1,9 @@
Cookiecutter Django Cookiecutter Django
======================= =======================
.. image:: https://requires.io/github/pydanny/cookiecutter-django/requirements.svg?branch=master .. image:: https://pyup.io/repos/github/pydanny/cookiecutter-django/shield.svg
:target: https://requires.io/github/pydanny/cookiecutter-django/requirements/?branch=master :target: https://pyup.io/repos/github/pydanny/cookiecutter-django/
:alt: Requirements Status :alt: Updates
.. image:: https://travis-ci.org/pydanny/cookiecutter-django.svg?branch=master .. image:: https://travis-ci.org/pydanny/cookiecutter-django.svg?branch=master
:target: https://travis-ci.org/pydanny/cookiecutter-django?branch=master :target: https://travis-ci.org/pydanny/cookiecutter-django?branch=master
@ -14,9 +14,12 @@ Cookiecutter Django
Powered by Cookiecutter_, Cookiecutter Django is a framework for jumpstarting production-ready Django projects quickly. Powered by Cookiecutter_, Cookiecutter Django is a framework for jumpstarting production-ready Django projects quickly.
* Documentation: https://cookiecutter-django.readthedocs.io/en/latest/
* See Troubleshooting_ for common errors and obstacles
.. _cookiecutter: https://github.com/audreyr/cookiecutter .. _cookiecutter: https://github.com/audreyr/cookiecutter
**Warning**: if you get the error "jinja2.exceptions.TemplateSyntaxError: Encountered unknown tag 'now'." , please upgrade your cookiecutter version to >= 1.4 (see issue # 528_ ) .. _Troubleshooting: https://cookiecutter-django.readthedocs.io/en/latest/troubleshooting.html
.. _528: https://github.com/pydanny/cookiecutter-django/issues/528#issuecomment-212650373 .. _528: https://github.com/pydanny/cookiecutter-django/issues/528#issuecomment-212650373
@ -25,20 +28,20 @@ Features
* For Django 1.9 * For Django 1.9
* Renders Django projects with 100% starting test coverage * Renders Django projects with 100% starting test coverage
* Twitter Bootstrap_ v4.0.0 - alpha_ * Twitter Bootstrap_ v4.0.0 - `alpha 3`_
* AngularJS_
* 12-Factor_ based settings via django-environ_ * 12-Factor_ based settings via django-environ_
* Optimized development and production settings * Optimized development and production settings
* Registration via django-allauth_ * Registration via django-allauth_
* Comes with custom user model ready to go. * Comes with custom user model ready to go
* Grunt build for compass and livereload * Grunt build for compass and livereload
* Basic e-mail configurations for sending emails via Mailgun_ * Send emails via Anymail_ (using Mailgun_ by default, but switchable)
* Media storage using Amazon S3 * Media storage using Amazon S3
* Docker support using docker-compose_ for development and production * Docker support using docker-compose_ for development and production
* Procfile_ for deploying to Heroku * Procfile_ for deploying to Heroku
* Instructions for deploying to PythonAnywhere_ * Instructions for deploying to PythonAnywhere_
* Works with Python 2.7.x or 3.5.x * Works with Python 2.7.x or 3.5.x
* Run tests with unittest or py.test * Run tests with unittest or py.test
* Customizable PostgreSQL version
Optional Integrations Optional Integrations
@ -50,24 +53,22 @@ Optional Integrations
* Configuration for Celery_ * Configuration for Celery_
* Integration with MailHog_ for local email testing * Integration with MailHog_ for local email testing
* Integration with Sentry_ for error logging * Integration with Sentry_ for error logging
* Integration with NewRelic_ for performance monitoring
* Integration with Opbeat_ for performance monitoring * Integration with Opbeat_ for performance monitoring
.. _alpha: http://blog.getbootstrap.com/2015/08/19/bootstrap-4-alpha/ .. _`alpha 3`: http://blog.getbootstrap.com/2016/07/27/bootstrap-4-alpha-3/
.. _Bootstrap: https://github.com/twbs/bootstrap .. _Bootstrap: https://github.com/twbs/bootstrap
.. _AngularJS: https://github.com/angular/angular.js
.. _django-environ: https://github.com/joke2k/django-environ .. _django-environ: https://github.com/joke2k/django-environ
.. _12-Factor: http://12factor.net/ .. _12-Factor: http://12factor.net/
.. _django-allauth: https://github.com/pennersr/django-allauth .. _django-allauth: https://github.com/pennersr/django-allauth
.. _django-avatar: https://github.com/jezdez/django-avatar/ .. _django-avatar: https://github.com/grantmcconnaughey/django-avatar
.. _Procfile: https://devcenter.heroku.com/articles/procfile .. _Procfile: https://devcenter.heroku.com/articles/procfile
.. _Mailgun: https://mailgun.com/ .. _Mailgun: http://www.mailgun.com/
.. _Whitenoise: https://whitenoise.readthedocs.io/ .. _Whitenoise: https://whitenoise.readthedocs.io/
.. _Celery: http://www.celeryproject.org/ .. _Celery: http://www.celeryproject.org/
.. _Anymail: https://github.com/anymail/django-anymail
.. _MailHog: https://github.com/mailhog/MailHog .. _MailHog: https://github.com/mailhog/MailHog
.. _Sentry: https://getsentry.com .. _Sentry: https://getsentry.com/welcome/
.. _NewRelic: https://newrelic.com .. _docker-compose: https://github.com/docker/compose
.. _docker-compose: https://www.github.com/docker/compose
.. _Opbeat: https://opbeat.com/ .. _Opbeat: https://opbeat.com/
.. _PythonAnywhere: https://www.pythonanywhere.com/ .. _PythonAnywhere: https://www.pythonanywhere.com/
@ -76,7 +77,7 @@ Constraints
----------- -----------
* Only maintained 3rd party libraries are used. * Only maintained 3rd party libraries are used.
* PostgreSQL everywhere (9.0+) * Uses PostgreSQL everywhere (9.2+)
* Environment variables for configuration (This won't work with Apache/mod_wsgi). * Environment variables for configuration (This won't work with Apache/mod_wsgi).
@ -98,8 +99,6 @@ You'll be prompted for some values. Provide them, then a Django project will be
**Warning**: After this point, change 'Daniel Greenfeld', 'pydanny', etc to your own information. **Warning**: After this point, change 'Daniel Greenfeld', 'pydanny', etc to your own information.
**Warning**: project_slug must be a valid Python module name or you will have issues on imports.
Answer the prompts with your own desired options_. For example:: Answer the prompts with your own desired options_. For example::
Cloning into 'cookiecutter-django'... Cloning into 'cookiecutter-django'...
@ -108,34 +107,45 @@ Answer the prompts with your own desired options_. For example::
remote: Total 550 (delta 283), reused 479 (delta 222) remote: Total 550 (delta 283), reused 479 (delta 222)
Receiving objects: 100% (550/550), 127.66 KiB | 58 KiB/s, done. Receiving objects: 100% (550/550), 127.66 KiB | 58 KiB/s, done.
Resolving deltas: 100% (283/283), done. Resolving deltas: 100% (283/283), done.
project_name [project_name]: Reddit Clone project_name [Project Name]: Reddit Clone
project_slug [Reddit_Clone]: reddit project_slug [reddit_clone]: reddit
author_name [Your Name]: Daniel Roy Greenfeld author_name [Daniel Roy Greenfeld]: Daniel Greenfeld
email [Your email]: pydanny@gmail.com email [you@example.com]: pydanny@gmail.com
description [A short description of the project.]: A reddit clone. description [A short description of the project.]: A reddit clone.
domain_name [example.com]: myreddit.com domain_name [example.com]: myreddit.com
version [0.1.0]: 0.0.1 version [0.1.0]: 0.0.1
timezone [UTC]: America/Los_Angeles timezone [UTC]: America/Los_Angeles
now [2016/03/01]: 2016/03/05
year [2016]:
use_whitenoise [y]: n use_whitenoise [y]: n
use_celery [n]: y use_celery [n]: y
use_mailhog [n]: n use_mailhog [n]: n
use_sentry [n]: y use_sentry_for_error_reporting [y]: y
use_newrelic [n]: y
use_opbeat [n]: y use_opbeat [n]: y
use_pycharm [n]: y use_pycharm [n]: y
windows [n]: n windows [n]: n
use_python2 [n]: n use_python3 [y]: y
use_docker [y]: y use_docker [y]: n
use_heroku [n]: n use_heroku [n]: y
use_grunt [n]: y use_compressor [n]: y
use_angular [n]: n 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: Select open_source_license:
1 - MIT 1 - MIT
2 - BSD 2 - BSD
3 - Not open source 3 - GPLv3
Choose from 1, 2, 3 [1]: 1 4 - Apache Software License 2.0
5 - Not open source
Choose from 1, 2, 3, 4, 5 [1]: 1
Enter the project and take a look around:: Enter the project and take a look around::
@ -152,7 +162,7 @@ Create a git repo and push it there::
Now take a look at your repo. Don't forget to carefully look at the generated README. Awesome, right? Now take a look at your repo. Don't forget to carefully look at the generated README. Awesome, right?
For development, see the following for local development: For local development, see the following:
* `Developing locally`_ * `Developing locally`_
* `Developing locally using docker`_ * `Developing locally using docker`_
@ -164,7 +174,7 @@ For development, see the following for local development:
Community Community
----------- -----------
* Got questions? **Before you ask questions anywhere else**, please post your question on `Stack Overflow`_ under the *cookiecutter-django* tag. We check there periodically for questions. * Have questions? **Before you ask questions anywhere else**, please post your question on `Stack Overflow`_ under the *cookiecutter-django* tag. We check there periodically for questions.
* If you think you found a bug or want to request a feature, please open an issue_. * If you think you found a bug or want to request a feature, please open an issue_.
* For anything else, you can chat with us on `Gitter`_. * For anything else, you can chat with us on `Gitter`_.
@ -185,7 +195,7 @@ Scattered throughout the Python and HTML of this project are places marked with
Releases Releases
-------- --------
Want a stable release? You can find them at https://github.com/pydanny/cookiecutter-django/releases Need a stable release? You can find them at https://github.com/pydanny/cookiecutter-django/releases
Not Exactly What You Want? Not Exactly What You Want?
@ -208,10 +218,10 @@ If you do rename your fork, I encourage you to submit it to the following places
.. _cookiecutter: https://github.com/audreyr/cookiecutter .. _cookiecutter: https://github.com/audreyr/cookiecutter
.. _grid: https://www.djangopackages.com/grids/g/cookiecutters/ .. _grid: https://www.djangopackages.com/grids/g/cookiecutters/
Or Submit a Pull Request Submit a Pull Request
~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~
We also accept pull requests on this, if they're small, atomic, and if they make our own project development We accept pull requests if they're small, atomic, and make our own project development
experience better. experience better.
Articles Articles
@ -223,14 +233,20 @@ Articles
* `Introduction to Cookiecutter-Django`_ - Feb. 19, 2016 * `Introduction to Cookiecutter-Django`_ - Feb. 19, 2016
* `Django and GitLab - Running Continuous Integration and tests with your FREE account`_ - May. 11, 2016 * `Django and GitLab - Running Continuous Integration and tests with your FREE account`_ - May. 11, 2016
Got a blog or online publication? Write about your cookiecutter-django tips and tricks, then send us a pull request with the link. Have a blog or online publication? Write about your cookiecutter-django tips and tricks, then send us a pull request with the link.
.. _`Development and Deployment of Cookiecutter-Django via Docker`: https://realpython.com/blog/python/development-and-deployment-of-cookiecutter-django-via-docker .. _`Development and Deployment of Cookiecutter-Django via Docker`: https://realpython.com/blog/python/development-and-deployment-of-cookiecutter-django-via-docker/
.. _`Development and Deployment of Cookiecutter-Django on Fedora`: https://realpython.com/blog/python/development-and-deployment-of-cookiecutter-django-on-fedora/ .. _`Development and Deployment of Cookiecutter-Django on Fedora`: https://realpython.com/blog/python/development-and-deployment-of-cookiecutter-django-on-fedora/
.. _`How to create a Django Application using Cookiecutter and Django 1.8`: http://blog.swapps.co/how-to-create-a-django-application-using-cookiecutter-and-django-1-8/#.VxKfBpMrKRs .. _`How to create a Django Application using Cookiecutter and Django 1.8`: https://www.swapps.io/blog/how-to-create-a-django-application-using-cookiecutter-and-django-1-8/
.. _`Introduction to Cookiecutter-Django`: http://krzysztofzuraw.com/blog/2016/django-cookiecutter.html .. _`Introduction to Cookiecutter-Django`: http://krzysztofzuraw.com/blog/2016/django-cookiecutter.html
.. _`Django and GitLab - Running Continuous Integration and tests with your FREE account`: http://dezoito.github.io/2016/05/11/django-gitlab-continuous-integration-phantomjs.html .. _`Django and GitLab - Running Continuous Integration and tests with your FREE account`: http://dezoito.github.io/2016/05/11/django-gitlab-continuous-integration-phantomjs.html
Code of Conduct
---------------
Everyone interacting in the Cookiecutter project's codebases, issue trackers, chat
rooms, and mailing lists is expected to follow the `PyPA Code of Conduct`_.
Support This Project Support This Project
--------------------------- ---------------------------
@ -240,4 +256,6 @@ This project is maintained by volunteers. Support their efforts by spreading the
:name: Two Scoops Academy :name: Two Scoops Academy
:align: center :align: center
:alt: Two Scoops Academy :alt: Two Scoops Academy
:target: http://www.twoscoops.academy/ :target: https://twoscoops.academy/
.. _`PyPA Code of Conduct`: https://www.pypa.io/en/latest/code-of-conduct/

View File

@ -1,26 +1,25 @@
{ {
"project_name": "project_name", "project_name": "Project Name",
"project_slug": "{{ cookiecutter.project_name.lower()|replace(' ', '_')|replace('-', '_') }}", "project_slug": "{{ cookiecutter.project_name.lower()|replace(' ', '_')|replace('-', '_') }}",
"author_name": "Your Name", "author_name": "Daniel Roy Greenfeld",
"email": "Your email", "email": "you@example.com",
"description": "A short description of the project.", "description": "A short description of the project.",
"domain_name": "example.com", "domain_name": "example.com",
"version": "0.1.0", "version": "0.1.0",
"timezone": "UTC", "timezone": "UTC",
"now": "{% now 'local' %}",
"year": "{{ cookiecutter.now[:4] }}",
"use_whitenoise": "y", "use_whitenoise": "y",
"use_celery": "n", "use_celery": "n",
"use_mailhog": "n", "use_mailhog": "n",
"use_sentry": "n", "use_sentry_for_error_reporting": "y",
"use_newrelic": "n",
"use_opbeat": "n", "use_opbeat": "n",
"use_pycharm": "n", "use_pycharm": "n",
"windows": "n", "windows": "n",
"use_python2": "n", "use_python3": "y",
"use_docker": "y", "use_docker": "y",
"use_heroku": "n", "use_heroku": "n",
"use_grunt": "n", "use_compressor": "n",
"use_angular": "n", "postgresql_version": ["9.5", "9.4", "9.3", "9.2"],
"open_source_license": ["MIT", "BSD", "Not open source"] "js_task_runner": ["Gulp", "Grunt", "None"],
"use_lets_encrypt": "n",
"open_source_license": ["MIT", "BSD", "GPLv3", "Apache Software License 2.0", "Not open source"]
} }

View File

@ -46,7 +46,7 @@ master_doc = 'index'
# General information about the project. # General information about the project.
project = 'Cookiecutter Django' project = 'Cookiecutter Django'
copyright = '2013-{}, Daniel Roy Greenfeld'.format(now.year) copyright = "2013-2016, Daniel Roy Greenfeld".format(now.year)
# The version info for the project you're documenting, acts as replacement for # The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the # |version| and |release|, also used in various other places throughout the

View File

@ -16,8 +16,8 @@ You can either push the 'deploy' button in your generated README.rst or run thes
heroku addons:create heroku-redis:hobby-dev heroku addons:create heroku-redis:hobby-dev
heroku addons:create mailgun heroku addons:create mailgun
heroku config:set DJANGO_ADMIN_URL=`openssl rand -base64 32` heroku config:set DJANGO_ADMIN_URL="$(openssl rand -base64 32)"
heroku config:set DJANGO_SECRET_KEY=`openssl rand -base64 64` heroku config:set DJANGO_SECRET_KEY="$(openssl rand -base64 64)"
heroku config:set DJANGO_SETTINGS_MODULE='config.settings.production' heroku config:set DJANGO_SETTINGS_MODULE='config.settings.production'
heroku config:set DJANGO_ALLOWED_HOSTS='.herokuapp.com' heroku config:set DJANGO_ALLOWED_HOSTS='.herokuapp.com'

View File

@ -1,49 +1,104 @@
Deployment with Docker Deployment with Docker
================================================= =======================
.. index:: Docker, deployment .. index:: Docker, deployment
TODO: Review and revise Prerequisites
-------------
**Warning** * Docker (at least 1.10)
* Docker Compose (at least 1.6)
Docker is evolving extremely fast, but it has still some rough edges here and there. Compose is currently (as of version 1.4) Understand the Compose Setup
not considered production ready. That means you won't be able to scale to multiple servers and you won't be able to run --------------------------------
zero downtime deployments out of the box. Consider all this as experimental until you understand all the implications
to run docker (with compose) on production.
**Run your app with docker-compose**
Prerequisites:
* docker (at least 1.10)
* docker-compose (at least 1.6)
Before you start, check out the `docker-compose.yml` file in the root of this project. This is where each component Before you start, check out the `docker-compose.yml` file in the root of this project. This is where each component
of this application gets its configuration from. It consists of a `postgres` service that runs the database, `redis` of this application gets its configuration from. Notice how it provides configuration for these services:
for caching, `nginx` as reverse proxy and last but not least the `django` application run by gunicorn.
{% if cookiecutter.use_celery == 'y' -%}
Since this application also runs Celery, there are two more services with a service called `celeryworker` that runs the
celery worker process and `celerybeat` that runs the celery beat process.
{% endif %}
* `postgres` service that runs the database
* `redis` for caching
* `nginx` as reverse proxy
* `django` is the Django project run by gunicorn
All of these services except `redis` rely on environment variables set by you. There is an `env.example` file in the If you chose the `use_celery` option, there are two more services:
* `celeryworker` which runs the celery worker process
* `celerybeat` which runs the celery beat process
If you chose the `use_letsencrypt` option, you also have:
* `certbot` which keeps your certs from letsencrypt up-to-date
Populate .env With Your Environment Variables
---------------------------------------------
Some of these services rely on environment variables set by you. There is an `env.example` file in the
root directory of this project as a starting point. Add your own variables to the file and rename it to `.env`. This root directory of this project as a starting point. Add your own variables to the file and rename it to `.env`. This
file won't be tracked by git by default so you'll have to make sure to use some other mechanism to copy your secret if file won't be tracked by git by default so you'll have to make sure to use some other mechanism to copy your secret if
you are relying solely on git. you are relying solely on git.
Optional: nginx-proxy Setup
---------------------------
By default, the application is configured to listen on all interfaces on port 80. If you want to change that, open the By default, the application is configured to listen on all interfaces on port 80. If you want to change that, open the
`docker-compose.yml` file and replace `0.0.0.0` with your own ip. If you are using `nginx-proxy`_ to run multiple `docker-compose.yml` file and replace `0.0.0.0` with your own ip.
application stacks on one host, remove the port setting entirely and add `VIRTUAL_HOST={{cookiecutter.domain_name}}` to your env file.
If you are using `nginx-proxy`_ to run multiple application stacks on one host, remove the port setting entirely and add `VIRTUAL_HOST=example.com` to your env file. Here, replace example.com with the value you entered for `domain_name`.
This pass all incoming requests on `nginx-proxy`_ to the nginx service your application is using. This pass all incoming requests on `nginx-proxy`_ to the nginx service your application is using.
.. _nginx-proxy: https://github.com/jwilder/nginx-proxy .. _nginx-proxy: https://github.com/jwilder/nginx-proxy
Optional: Postgres Data Volume Modifications
---------------------------------------------
Postgres is saving its database files to the `postgres_data` volume by default. Change that if you wan't Postgres is saving its database files to the `postgres_data` volume by default. Change that if you wan't
something else and make sure to make backups since this is not done automatically. something else and make sure to make backups since this is not done automatically.
Optional: Certbot and Let's Encrypt Setup
------------------------------------------
If you chose `use_letsencrypt` and will be using certbot for https, you must do the following before running anything with docker-compose:
Replace dhparam.pem.example with a generated dhparams.pem file before running anything with docker-compose. You can generate this on ubuntu or OS X by running the following in the project root:
::
$ openssl dhparam -out /path/to/project/compose/nginx/dhparams.pem 2048
If you would like to add additional subdomains to your certificate, you must add additional parameters to the certbot command in the `docker-compose.yml` file:
Replace:
::
command: bash -c "sleep 6 && certbot certonly -n --standalone -d {{ cookiecutter.domain_name }} --text --agree-tos --email mjsisley@relawgo.com --server https://acme-v01.api.letsencrypt.org/directory --rsa-key-size 4096 --verbose --keep-until-expiring --standalone-supported-challenges http-01"
With:
::
command: bash -c "sleep 6 && certbot certonly -n --standalone -d {{ cookiecutter.domain_name }} -d www.{{ cookiecutter.domain_name }} -d etc.{{ cookiecutter.domain_name }} --text --agree-tos --email {{ cookiecutter.email }} --server https://acme-v01.api.letsencrypt.org/directory --rsa-key-size 4096 --verbose --keep-until-expiring --standalone-supported-challenges http-01"
Please be cognizant of Certbot/Letsencrypt certificate requests limits when getting this set up. The provide a test server that does not count against the limit while you are getting set up.
The certbot certificates expire after 3 months.
If you would like to set up autorenewal of your certificates, the following commands can be put into a bash script:
::
#!/bin/bash
cd <project directory>
docker-compose run --rm --name certbot certbot bash -c "sleep 6 && certbot certonly --standalone -d {{ cookiecutter.domain_name }} --text --agree-tos --email {{ cookiecutter.email }} --server https://acme-v01.api.letsencrypt.org/directory --rsa-key-size 4096 --verbose --keep-until-expiring --standalone-supported-challenges http-01"
docker exec pearl_nginx_1 nginx -s reload
And then set a cronjob by running `crontab -e` and placing in it (period can be adjusted as desired)::
0 4 * * 1 /path/to/bashscript/renew_certbot.sh
Run your app with docker-compose
--------------------------------
To get started, pull your code from source control (don't forget the `.env` file) and change to your projects root To get started, pull your code from source control (don't forget the `.env` file) and change to your projects root
directory. directory.
@ -55,7 +110,6 @@ Once this is ready, you can run it with::
docker-compose up docker-compose up
To run a migration, open up a second terminal and run:: To run a migration, open up a second terminal and run::
docker-compose run django python manage.py migrate docker-compose run django python manage.py migrate
@ -64,7 +118,6 @@ To create a superuser, run::
docker-compose run django python manage.py createsuperuser docker-compose run django python manage.py createsuperuser
If you need a shell, run:: If you need a shell, run::
docker-compose run django python manage.py shell docker-compose run django python manage.py shell
@ -80,8 +133,15 @@ If you want to scale your application, run::
docker-compose scale django=4 docker-compose scale django=4
docker-compose scale celeryworker=2 docker-compose scale celeryworker=2
.. warning:: Don't run the scale command on postgres, celerybeat, certbot, or nginx.
**Don't run the scale command on postgres or celerybeat** If you have errors, you can always check your stack with `docker-compose`. Switch to your projects root directory and run::
docker-compose ps
Supervisor Example
-------------------
Once you are ready with your initial setup, you wan't to make sure that your application is run by a process manager to Once you are ready with your initial setup, you wan't to make sure that your application is run by a process manager to
survive reboots and auto restarts in case of an error. You can use the process manager you are most familiar with. All survive reboots and auto restarts in case of an error. You can use the process manager you are most familiar with. All
@ -97,7 +157,6 @@ If you are using `supervisor`, you can use this file as a starting point::
autorestart=true autorestart=true
priority=10 priority=10
Place it in `/etc/supervisor/conf.d/{{cookiecutter.project_slug}}.conf` and run:: Place it in `/etc/supervisor/conf.d/{{cookiecutter.project_slug}}.conf` and run::
supervisorctl reread supervisorctl reread
@ -106,7 +165,3 @@ Place it in `/etc/supervisor/conf.d/{{cookiecutter.project_slug}}.conf` and run:
To get the status, run:: To get the status, run::
supervisorctl status supervisorctl status
If you have errors, you can always check your stack with `docker-compose`. Switch to your projects root directory and run::
docker-compose ps

View File

@ -1,5 +1,5 @@
Getting Up and Running with Docker Getting Up and Running Locally With Docker
================================== ==========================================
.. index:: Docker .. index:: Docker
@ -9,40 +9,17 @@ All of these commands assume you are in the root of your generated project.
Prerequisites Prerequisites
------------- -------------
You'll need at least docker 1.10. You'll need at least Docker 1.10.
If you don't already have it installed, follow the instructions for your OS: If you don't already have it installed, follow the instructions for your OS:
- On Mac OS X/Windows, you'll need `Docker Toolbox`_ - On Mac OS X, you'll need `Docker for Mac`_
- On Windows, you'll need `Docker for Windows`_
- On Linux, you'll need `docker-engine`_ - On Linux, you'll need `docker-engine`_
.. _`Docker Toolbox`: https://github.com/docker/toolbox/releases .. _`Docker for Mac`: https://docs.docker.com/engine/installation/mac/
.. _`Docker for Windows`: https://docs.docker.com/engine/installation/windows/
.. _`docker-engine`: https://docs.docker.com/engine/installation/ .. _`docker-engine`: https://docs.docker.com/engine/installation/
Create the Machine (Optional)
-----------------------------
On Linux you have native Docker, so you don't need to create a VM with
docker-machine to use it.
However, on Mac/Windows/other systems without native Docker, you'll want to
start by creating a VM with docker-machine::
$ docker-machine create --driver virtualbox dev1
**Note:** If you want to have more than one docker development environment, then
name them accordingly. Instead of 'dev1' you might have 'dev2', 'myproject',
'djangopackages', et al.
Get the IP Address
------------------
Once your machine is up and running, run this::
$ docker-machine ip dev1
123.456.789.012
This is also the IP address where the Django project will be served from.
Build the Stack Build the Stack
--------------- ---------------
@ -105,35 +82,6 @@ Production Mode
Instead of using `dev.yml`, you would use `docker-compose.yml`. Instead of using `dev.yml`, you would use `docker-compose.yml`.
Database Backups
~~~~~~~~~~~~~~~~
The database has to be running to create/restore a backup.
First, run the app with `docker-compose -f dev.yml up`.
To create a backup, run::
docker-compose -f dev.yml run postgres backup
To list backups, run::
docker-compose -f dev.yml run postgres list-backups
To restore a backup, run::
docker-compose -f dev.yml run postgres restore filename.sql
To copy the files from the running Postgres container to the host system::
docker cp <containerId>:/backups /host/path/target
Where <containerId> is the ID of the Postgres container. To get it, run::
docker ps
Other Useful Tips Other Useful Tips
----------------- -----------------
@ -155,3 +103,54 @@ If you want to run the stack in detached mode (in the background), use the ``-d`
:: ::
$ docker-compose -f dev.yml up -d $ docker-compose -f dev.yml up -d
Debugging
~~~~~~~~~~~~~
ipdb
"""""
If you are using the following within your code to debug:
::
import ipdb; ipdb.set_trace()
Then you may need to run the following for it to work as desired:
::
$ docker-compose run -f dev.yml --service-ports django
django-debug-toolbar
""""""""""""""""""""
In order for django-debug-toolbar to work with docker you need to add your docker-machine ip address (the output of `Get the IP ADDRESS`_) to INTERNAL_IPS in local.py
.. May be a better place to put this, as it is not Docker specific.
You may need to add the following to your css in order for the django-debug-toolbar to be visible (this applies whether Docker is being used or not):
.. code-block:: css
/* Override Bootstrap 4 styling on Django Debug Toolbar */
#djDebug[hidden], #djDebug [hidden] {
display: block !important;
}
#djDebug [hidden][style='display: none;'] {
display: none !important;
}
Using the Mailhog Docker Container
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In development you can (optionally) use MailHog_ for email testing. If you selected `use_docker`, MailHog is added as a Docker container. To use MailHog:
1. Make sure, that ``mailhog`` docker container is up and running
2. Open your browser and go to ``http://127.0.0.1:8025``
.. _Mailhog: https://github.com/mailhog/MailHog/

View File

@ -9,40 +9,50 @@ The steps below will get you up and running with a local development environment
* virtualenv * virtualenv
* PostgreSQL * PostgreSQL
First make sure to create and activate a virtualenv_, then open a terminal at the project root and install the os dependencies:: First make sure to create and activate a virtualenv_.
$ sudo ./install_os_dependencies.sh install .. _virtualenv: http://docs.python-guide.org/en/latest/dev/virtualenvs/
Then install the requirements for your local development:: Then install the requirements for your local development::
$ pip install -r requirements/local.txt $ pip install -r requirements/local.txt
.. _virtualenv: http://docs.python-guide.org/en/latest/dev/virtualenvs/
Then, create a PostgreSQL database with the following command, where `[project_slug]` is what value you entered for your project's `project_slug`:: Then, create a PostgreSQL database with the following command, where `[project_slug]` is what value you entered for your project's `project_slug`::
$ createdb [project_slug] $ createdb [project_slug]
`Cookiecutter Django` uses the excellent `django-environ`_ package with its ``DATABASE_URL`` environment variable to simplify database configuration in your Django settings. Now all you have to do is rename env.example to .env and then compose a definition for ``DATABASE_URL`` as shown below and add it to the .env file:
.. parsed-literal::
$ export DATABASE_URL="postgres://*<pg_user_name>*:*<pg_user_password>*\ @127.0.0.1:\ *<pg_port>*/*<pg_database_name>*"
.. _django-environ: http://django-environ.readthedocs.io
You can now run the usual Django ``migrate`` and ``runserver`` commands:: You can now run the usual Django ``migrate`` and ``runserver`` commands::
$ python manage.py migrate $ python manage.py migrate
$ python manage.py runserver $ python manage.py runserver
**Setup your email backend** At this point you can take a break from setup and start getting to know the files in the project.
But if you want to go further with setup, read on.
(Note: the following sections still need to be revised)
Setting Up Env Vars for Production
-----------------------------------
`Cookiecutter Django` uses the excellent `django-environ`_ package, which includes a ``DATABASE_URL`` environment variable to simplify database configuration in your Django settings.
Rename env.example to .env to begin updating the file with your own environment variables. To add your database, define ``DATABASE_URL`` and add it to the .env file, as shown below:
.. parsed-literal::
DATABASE_URL="postgres://*<pg_user_name>*:*<pg_user_password>*\ @127.0.0.1:\ *<pg_port>*/*<pg_database_name>*"
.. _django-environ: http://django-environ.readthedocs.io
Setup your email backend
-------------------------
django-allauth sends an email to verify users (and superusers) after signup and login (if they are still not verified). To send email you need to `configure your email backend`_ django-allauth sends an email to verify users (and superusers) after signup and login (if they are still not verified). To send email you need to `configure your email backend`_
.. _configure your email backend: http://docs.djangoproject.com/en/1.9/topics/email/#smtp-backend .. _configure your email backend: http://docs.djangoproject.com/en/1.9/topics/email/#smtp-backend
In development you can (optionally) use MailHog_ for email testing. MailHog is built with Go so there are no dependencies. To use MailHog:: In development you can (optionally) use MailHog_ for email testing. MailHog is built with Go so there are no dependencies. To use MailHog:
1. `Download the latest release`_ for your operating system 1. `Download the latest release`_ for your operating system
2. Rename the executable to ``mailhog`` and copy it to the root of your project directory 2. Rename the executable to ``mailhog`` and copy it to the root of your project directory
@ -61,22 +71,6 @@ In production basic email configuration is setup to send emails with Mailgun_
**Live reloading and Sass CSS compilation** **Live reloading and Sass CSS compilation**
If you'd like to take advantage of live reloading and Sass / Compass CSS compilation you can do so with the included Grunt task. If youd like to take advantage of live reloading and Sass / Compass CSS compilation you can do so with a little bit of `prep work`_.
Make sure that nodejs_ is installed. Then in the project root run:: .. _prep work: https://cookiecutter-django.readthedocs.io/en/latest/live-reloading-and-sass-compilation.html
$ npm install
.. _nodejs: http://nodejs.org/download/
Now you just need::
$ grunt serve
The base app will now run as it would with the usual ``manage.py runserver`` but with live reloading and Sass compilation enabled.
To get live reloading to work you'll probably need to install an `appropriate browser extension`_
.. _appropriate browser extension: http://feedback.livereload.com/knowledgebase/articles/86242-how-do-i-install-and-use-the-browser-extensions-
It's time to write the code!!!

View File

@ -0,0 +1,40 @@
============================
Database Backups with Docker
============================
The database has to be running to create/restore a backup. These examples show local examples. If you want to use it on a remote server, remove ``-f dev.yml`` from each example.
Running Backups
================
Run the app with `docker-compose -f dev.yml up`.
To create a backup, run::
docker-compose -f dev.yml run postgres backup
To list backups, run::
docker-compose -f dev.yml run postgres list-backups
To restore a backup, run::
docker-compose -f dev.yml run postgres restore filename.sql
Where <containerId> is the ID of the Postgres container. To get it, run::
docker ps
To copy the files from the running Postgres container to the host system::
docker cp <containerId>:/backups /host/path/target
Restoring From Backups
======================
To restore the production database to a local PostgreSQL database::
createdb NAME_OF_DATABASE
psql NAME_OF_DATABASE < NAME_OF_BACKUP_FILE

View File

@ -7,14 +7,11 @@ A Cookiecutter_ template for Django.
.. _cookiecutter: https://github.com/audreyr/cookiecutter .. _cookiecutter: https://github.com/audreyr/cookiecutter
.. note:: This is an in-progress documentation reorganization. Locations of files may change dramatically over the course of the next few days. See https://github.com/pydanny/cookiecutter-django/issues/335
Contents: Contents:
.. toctree:: .. toctree::
:maxdepth: 2 :maxdepth: 2
project-generation-options project-generation-options
developing-locally developing-locally
developing-locally-docker developing-locally-docker
@ -24,7 +21,10 @@ Contents:
deployment-on-pythonanywhere deployment-on-pythonanywhere
deployment-on-heroku deployment-on-heroku
deployment-with-docker deployment-with-docker
docker-postgres-backups
faq faq
troubleshooting
my-favorite-cookie
Indices and tables Indices and tables
================== ==================

View File

@ -0,0 +1,17 @@
PostgreSQL Installation Basics
==============================
.. index:: pip, virtualenv, PostgreSQL
The steps below will get you up and running with PostgreSQL. This assumes you have pip and virtualenv_ installed.
.. _virtualenv: http://docs.python-guide.org/en/latest/dev/virtualenvs/
On Mac
Install PostgreSQLapp_ from the browser and move PostGresSQL into your applications folder. Then install PostgreSQL from HomeBrew_.
$ brew install postgres
.. _PostgreSQLapp: http://postgresapp.com/
.. _HomeBrew: http://brew.sh/

100
docs/my-favorite-cookie.rst Normal file
View File

@ -0,0 +1,100 @@
************************************************
Creating your first app with Cookiecutter-Django
************************************************
This tutorial will show you how to build a simple app using the `Cookiecutter Django <https://github.com/pydanny/cookiecutter-django>`_ templating system. We'll be building a cookie polling app to determine the most popular flavor of cookie.
Developers who have never used Django will learn the basics of creating a Django app; developers who are experienced with Django will learn how to set up a project within the Cookiecutter system. While many Django tutorials use the default SQLite database, Cookiecutter Django uses PostGres only, so we'll have you install and use that.
Dependencies
============
This tutorial was written on Windows 10 using `git bash <https://git-for-windows.github.io/>`_; alternate instructions for Mac OS and Linux will be provided when needed. Any Linux-style shell should work for the following commands.
You should have your preferred versions of `Python <https://www.python.org/downloads/>`_
and `Django <https://www.djangoproject.com/download/>`_ installed. Use the latest stable versions if you have no preference.
You should have `Virtualenv <https://virtualenv.pypa.io/en/stable/>`_ and `Cookiecutter <https://github.com/pydanny/cookiecutter-django/>`_ installed:
.. code-block:: python
$ pip install virtualenv
$ pip install cookiecutter
You should also have `PostgreSQL <https://www.postgresql.org/download/>`_ installed on your machine--just download and run the installer for your OS. The install menu will prompt you for a password, which you'll use when creating the project's database.
Instructions
============
1. **Setup** -- how to set up a virtual environment
2. **Cookiecutter** -- use Cookiecutter to initialize a project with your own customized information.
3. **Building the App** -- creating the My Favorite Cookie application.
============
1. Setup
============
Virtual Environment
"""""""""""""""""""
Create a virtual environment for your project. Cookiecutter will install a bunch of dependencies for you automatically; using a virtualenv will prevent this from interfering with your other work.
.. code-block:: python
$ virtualenv c:/.virtualenvs/cookie_polls
Replace ``c:/.virtualenvs`` with the path to your own ``.virtualenvs`` folder.
Activate the virtual environment by calling ``source`` on the ``activate`` shell script . On Windows you'll call this from the virtualenv's ``scripts`` folder:
.. code-block:: python
$ source /path/to/.virtualenvs/cookie_polls/scripts/activate
On other operating systems, it'll be found in the ``bin`` folder.
.. code-block:: python
$ source /path/to/.virtualenvs/cookie_polls/bin/activate
You'll know the virtual environment is active because its name will appear in parentheses before the command prompt. When you're done with this project, you can leave the virtual environment with the ``deactivate`` command.
.. code-block:: python
(cookie_polls)
$ deactivate
Now you're ready to create your project using Cookiecutter.
===============
2. Cookiecutter
===============
Django developers may be familiar with the ``startproject`` command, which initializes the directory structure and required files for a bare-bones Django project. While this is fine when you're just learning Django for the first time, it's not great for a real production app. Cookiecutter takes care of a lot of standard tasks for you, including installing software dependencies, setting up testing files, and including and organizing common libraries like Bootstrap and AngularJS. It also generates a software license and a README.
Change directories into the folder where you want your project to live, and run ``cookiecutter`` followed by the URL of Cookiecutter's Github repo.
.. code-block:: python
$ cd /my/project/folder
(cookie_polls)
my/project/folder
$ cookiecutter https://github.com/pydanny/cookiecutter-django
This will prompt you for a bunch of values specific to your project. Press "enter" without typing anything to use the default values, which are shown in [brackets] after the question. You can learn about all the different options `here, <http://cookiecutter-django.readthedocs.io/en/latest/project-generation-options.html>`_ but for now we'll use the defaults for everything but your name, your email, the project's name, and the project's description.
.. code-block:: python
project_name [project_name]: My Favorite Cookie
project_slug [My_Favorite_Cookie]:
author_name [Your Name]: Emily Cain
email [Your email]: contact@emcain.net
description [A short description of the project.]: Poll your friends to determine the most popular cookie.
Then hit "enter" to use the default values for everything else.

View File

@ -37,19 +37,75 @@ use_celery [n]
use_mailhog [n] use_mailhog [n]
Whether to use MailHog_. MailHog is a tool that simulates email receiving Whether to use MailHog_. MailHog is a tool that simulates email receiving
for development purposes. It runs a simple SMTP server which catches for development purposes. It runs a simple SMTP server which catches
any message sent to it. Messages are displayed in a web interface which runs at ``http://localhost:8025/`` You need to download the MailHog executable for your operating system, see the 'Developing Locally' docs for instructions. any message sent to it. Messages are displayed in a web interface which
runs at ``http://localhost:8025/`` You need to download the MailHog
executable for your operating system, see the 'Developing Locally' docs
for instructions.
use_sentry [n] use_sentry_for_error_reporting [n]
Whether to use Sentry_ to log errors from your project. Whether to use Sentry_ to log errors from your project.
use_opbeat [n]
Whether to use Opbeat_ for preformance monitoring and code optimization.
use_pycharm [n]
Adds support for developing in PyCharm_ with a preconfigured .idea directory.
windows [n] windows [n]
Whether you'll be developing on Windows. Whether you'll be developing on Windows.
use_python2 [n] use_python3 [y]
By default, the Python code generated will be for Python 3.x. But if you By default, the Python code generated will be for Python 3.x. But if you
answer `y` here, it will be legacy Python 2.7 code. answer `n` here, it will be legacy Python 2.7 code.
use_docker [y]
Whether to use Docker_, separating the app and database into separate
containers.
use_heroku [n]
Add configuration to deploy the application to a Heroku_ instance.
use_compressor [n]
Use `Django Compressor`_ to minify and combine rendered JavaScript and CSS
into cachable static resources.
js_task_runner [1]
Select a JavaScript task runner. The choices are:
1. Gulp_
2. Grunt_
3. Webpack_
4. None
use_lets_encrypt [n]
Use `Let's Encrypt`_ as the certificate authority for this project.
open_source_license [1]
Select a software license for the project. The choices are:
1. MIT_
2. BSD_
3. GPLv3_
4. `Apache Software License 2.0`_
5. Not open source
**NOTE:** *If you choose to use Docker, selecting a JavaScript task runner is
not supported out of the box.*
.. _WhiteNoise: https://github.com/evansd/whitenoise .. _WhiteNoise: https://github.com/evansd/whitenoise
.. _Celery: https://github.com/celery/celery .. _Celery: https://github.com/celery/celery
.. _MailHog: https://github.com/mailhog/MailHog .. _MailHog: https://github.com/mailhog/MailHog
.. _Sentry: https://github.com/getsentry/sentry .. _Sentry: https://github.com/getsentry/sentry
.. _Opbeat: https://github.com/opbeat/opbeat_python
.. _PyCharm: https://www.jetbrains.com/pycharm/
.. _Docker: https://github.com/docker/docker
.. _Heroku: https://github.com/heroku/heroku-buildpack-python
.. _Django Compressor: https://github.com/django-compressor/django-compressor
.. _Gulp: https://github.com/gulpjs/gulp
.. _Grunt: https://github.com/gruntjs/grunt
.. _Webpack: https://github.com/webpack/webpack
.. _Let's Encrypt: https://github.com/certbot/certbot
.. _MIT: https://opensource.org/licenses/MIT
.. _BSD: https://opensource.org/licenses/BSD-3-Clause
.. _GPLv3: https://www.gnu.org/licenses/gpl.html
.. _Apache Software License 2.0: http://www.apache.org/licenses/LICENSE-2.0

9
docs/troubleshooting.rst Normal file
View File

@ -0,0 +1,9 @@
Troubleshooting
=====================================
This page contains some advice about errors and problems commonly encountered during the development of Cookiecutter Django applications.
#. If you get the error ``jinja2.exceptions.TemplateSyntaxError: Encountered unknown tag 'now'.`` , please upgrade your cookiecutter version to >= 1.4 (see issue # 528_ )
#. ``project_slug`` must be a valid Python module name or you will have issues on imports.
.. _528: https://github.com/pydanny/cookiecutter-django/issues/528#issuecomment-212650373

View File

@ -82,6 +82,11 @@ def make_secret_key(project_directory):
set_secret_key(env_file) set_secret_key(env_file)
def remove_file(file_name):
if os.path.exists(file_name):
os.remove(file_name)
def remove_task_app(project_directory): def remove_task_app(project_directory):
"""Removes the taskapp if celery isn't going to be used""" """Removes the taskapp if celery isn't going to be used"""
# Determine the local_setting_file_location # Determine the local_setting_file_location
@ -111,9 +116,8 @@ def remove_heroku_files():
Removes files needed for heroku if it isn't going to be used Removes files needed for heroku if it isn't going to be used
""" """
for filename in ["app.json", "Procfile", "requirements.txt", "runtime.txt"]: for filename in ["app.json", "Procfile", "requirements.txt", "runtime.txt"]:
os.remove(os.path.join( file_name = os.path.join(PROJECT_DIRECTORY, filename)
PROJECT_DIRECTORY, filename remove_file(file_name)
))
def remove_docker_files(): def remove_docker_files():
@ -134,7 +138,43 @@ def remove_grunt_files():
""" """
Removes files needed for grunt if it isn't going to be used Removes files needed for grunt if it isn't going to be used
""" """
for filename in ["Gruntfile.js", "package.json"]: for filename in ["Gruntfile.js"]:
os.remove(os.path.join(
PROJECT_DIRECTORY, filename
))
def remove_gulp_files():
"""
Removes files needed for grunt if it isn't going to be used
"""
for filename in ["gulpfile.js"]:
os.remove(os.path.join(
PROJECT_DIRECTORY, filename
))
def remove_packageJSON_file():
"""
Removes files needed for grunt if it isn't going to be used
"""
for filename in ["package.json"]:
os.remove(os.path.join(
PROJECT_DIRECTORY, filename
))
def remove_certbot_files():
"""
Removes files needed for certbot if it isn't going to be used
"""
nginx_dir_location = os.path.join(PROJECT_DIRECTORY, 'compose/nginx')
for filename in ["nginx-secure.conf", "start.sh", "dhparams.example.pem"]:
file_name = os.path.join(nginx_dir_location, filename)
remove_file(file_name)
def remove_copying_files():
"""
Removes files needed for the GPLv3 licence if it isn't going to be used
"""
for filename in ["COPYING"]:
os.remove(os.path.join( os.remove(os.path.join(
PROJECT_DIRECTORY, filename PROJECT_DIRECTORY, filename
)) ))
@ -176,19 +216,47 @@ if '{{ cookiecutter.use_heroku }}'.lower() != 'y':
if '{{ cookiecutter.use_docker }}'.lower() != 'y': if '{{ cookiecutter.use_docker }}'.lower() != 'y':
remove_docker_files() remove_docker_files()
# 6. Removes all grunt files if it isn't going to be used # 6. Removes all JS task manager files if it isn't going to be used
if '{{ cookiecutter.use_grunt }}'.lower() != 'y': if '{{ cookiecutter.js_task_runner}}'.lower() == 'gulp':
remove_grunt_files() remove_grunt_files()
elif '{{ cookiecutter.js_task_runner}}'.lower() == 'grunt':
remove_gulp_files()
else:
remove_gulp_files()
remove_grunt_files()
remove_packageJSON_file()
# 7. Removes all certbot/letsencrypt files if it isn't going to be used
if '{{ cookiecutter.use_lets_encrypt }}'.lower() != 'y':
remove_certbot_files()
# 7. Display a warning if use_docker and use_grunt are selected. Grunt isn't supported by our # 8. Display a warning if use_docker and use_grunt are selected. Grunt isn't
# docker config atm. # supported by our docker config atm.
if '{{ cookiecutter.use_grunt }}'.lower() == 'y' and '{{ cookiecutter.use_docker }}'.lower() == 'y': if '{{ cookiecutter.js_task_runner }}'.lower() in ['grunt', 'gulp'] and '{{ cookiecutter.use_docker }}'.lower() == 'y':
print( print(
"You selected to use docker and grunt. This is NOT supported out of the box for now. You " "You selected to use docker and a JS task runner. This is NOT supported out of the box for now. You "
"can continue to use the project like you normally would, but you will need to add a " "can continue to use the project like you normally would, but you will need to add a "
" grunt service to your docker configuration manually." "js task runner service to your docker configuration manually."
) )
# 9. Removes the certbot/letsencrypt files and display a warning if use_lets_encrypt is selected and use_docker isn't.
if '{{ cookiecutter.use_lets_encrypt }}'.lower() == 'y' and '{{ cookiecutter.use_docker }}'.lower() != 'y':
remove_certbot_files()
print(
"You selected to use Let's Encrypt and didn't select to use docker. This is NOT supported out of the box for now. You "
"can continue to use the project like you normally would, but Let's Encrypt files have been included."
)
# 10. Directs the user to the documentation if certbot and docker are selected.
if '{{ cookiecutter.use_lets_encrypt }}'.lower() == 'y' and '{{ cookiecutter.use_docker }}'.lower() == 'y':
print(
"You selected to use Let's Encrypt, please see the documentation for instructions on how to use this in production. "
"You must generate a dhparams.pem file before running docker-compose in a production environment."
)
# 11. Removes files needed for the GPLv3 licence if it isn't going to be used.
if '{{ cookiecutter.open_source_license}}' != 'GPLv3':
remove_copying_files()
# 4. Copy files from /docs/ to {{ cookiecutter.project_slug }}/docs/ # 4. Copy files from /docs/ to {{ cookiecutter.project_slug }}/docs/
# copy_doc_files(PROJECT_DIRECTORY) # copy_doc_files(PROJECT_DIRECTORY)

View File

@ -1,8 +1,6 @@
import cookiecutter
project_slug = '{{ cookiecutter.project_slug }}' project_slug = '{{ cookiecutter.project_slug }}'
if hasattr(project_slug, 'isidentifier'): if hasattr(project_slug, 'isidentifier'):
assert project_slug.isidentifier(), 'Project slug should be valid Python identifier!' assert project_slug.isidentifier(), 'Project slug should be valid Python identifier!'
assert cookiecutter.__version__ > '1.3.0', 'Please upgrade your Cookiecutter installation'

View File

@ -1,11 +1,11 @@
cookiecutter==1.4.0 cookiecutter==1.4.0
flake8==2.5.4 flake8==3.0.4 # pyup: != 2.6.0
sh==1.11 sh==1.11
binaryornot==0.4.0 binaryornot==0.4.0
# Testing # Testing
pytest==2.9.1 pytest==3.0.2
pep8==1.7.0 pep8==1.7.0
pyflakes==1.2.3 pyflakes==1.3.0
tox==2.3.1 tox==2.3.1
pytest-cookies==0.2.0 pytest-cookies==0.2.0

View File

@ -0,0 +1,2 @@
# These requirements prevented an upgrade to Django 1.10.
django-coverage-plugin==1.3.1

View File

@ -10,7 +10,7 @@ except ImportError:
# Our version ALWAYS matches the version of Django we support # Our version ALWAYS matches the version of Django we support
# If Django has a new release, we branch, tag, then update this setting after the tag. # If Django has a new release, we branch, tag, then update this setting after the tag.
version = '1.9.6' version = '1.9.9-03'
if sys.argv[-1] == 'tag': if sys.argv[-1] == 'tag':
os.system('git tag -a %s -m "version %s"' % (version, version)) os.system('git tag -a %s -m "version %s"' % (version, version))

View File

@ -22,8 +22,6 @@ def context():
'domain_name': 'example.com', 'domain_name': 'example.com',
'version': '0.1.0', 'version': '0.1.0',
'timezone': 'UTC', 'timezone': 'UTC',
'now': '2015/01/13',
'year': '2015'
} }

View File

@ -6,7 +6,7 @@ envlist = py27,py34,py35
passenv = LC_ALL, LANG, HOME passenv = LC_ALL, LANG, HOME
deps = deps =
binaryornot binaryornot
flake8 flake8==2.5.5
pytest-cookies pytest-cookies
sh sh
commands = py.test {posargs:tests} commands = py.test {posargs:tests}

View File

@ -8,7 +8,7 @@ before_install:
- sudo apt-get install -qq libsqlite3-dev libxml2 libxml2-dev libssl-dev libbz2-dev wget curl llvm - sudo apt-get install -qq libsqlite3-dev libxml2 libxml2-dev libssl-dev libbz2-dev wget curl llvm
language: python language: python
python: python:
{% if cookiecutter.use_python2 == 'n' -%} {% if cookiecutter.use_python3 == 'y' -%}
- "3.5" - "3.5"
{% else %} {% else %}
- "2.7" - "2.7"

View File

@ -1 +1 @@
{{cookiecutter.author_name}} {{ cookiecutter.author_name }}

View File

@ -0,0 +1,674 @@
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The GNU General Public License is a free, copyleft license for
software and other kinds of works.
The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
the GNU General Public License is intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users. We, the Free Software Foundation, use the
GNU General Public License for most of our software; it applies also to
any other work released this way by its authors. You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.
To protect your rights, we need to prevent others from denying you
these rights or asking you to surrender the rights. Therefore, you have
certain responsibilities if you distribute copies of the software, or if
you modify it: responsibilities to respect the freedom of others.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must pass on to the recipients the same
freedoms that you received. You must make sure that they, too, receive
or can get the source code. And you must show them these terms so they
know their rights.
Developers that use the GNU GPL protect your rights with two steps:
(1) assert copyright on the software, and (2) offer you this License
giving you legal permission to copy, distribute and/or modify it.
For the developers' and authors' protection, the GPL clearly explains
that there is no warranty for this free software. For both users' and
authors' sake, the GPL requires that modified versions be marked as
changed, so that their problems will not be attributed erroneously to
authors of previous versions.
Some devices are designed to deny users access to install or run
modified versions of the software inside them, although the manufacturer
can do so. This is fundamentally incompatible with the aim of
protecting users' freedom to change the software. The systematic
pattern of such abuse occurs in the area of products for individuals to
use, which is precisely where it is most unacceptable. Therefore, we
have designed this version of the GPL to prohibit the practice for those
products. If such problems arise substantially in other domains, we
stand ready to extend this provision to those domains in future versions
of the GPL, as needed to protect the freedom of users.
Finally, every program is threatened constantly by software patents.
States should not allow patents to restrict development and use of
software on general-purpose computers, but in those that do, we wish to
avoid the special danger that patents applied to a free program could
make it effectively proprietary. To prevent this, the GPL assures that
patents cannot be used to render the program non-free.
The precise terms and conditions for copying, distribution and
modification follow.
TERMS AND CONDITIONS
0. Definitions.
"This License" refers to version 3 of the GNU General Public License.
"Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.
"The Program" refers to any copyrightable work licensed under this
License. Each licensee is addressed as "you". "Licensees" and
"recipients" may be individuals or organizations.
To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy. The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.
A "covered work" means either the unmodified Program or a work based
on the Program.
To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy. Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.
To "convey" a work means any kind of propagation that enables other
parties to make or receive copies. Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.
An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License. If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.
1. Source Code.
The "source code" for a work means the preferred form of the work
for making modifications to it. "Object code" means any non-source
form of a work.
A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.
The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form. A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.
The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities. However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work. For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.
The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.
The Corresponding Source for a work in source code form is that
same work.
2. Basic Permissions.
All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met. This License explicitly affirms your unlimited
permission to run the unmodified Program. The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work. This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.
You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force. You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright. Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.
Conveying under any other circumstances is permitted solely under
the conditions stated below. Sublicensing is not allowed; section 10
makes it unnecessary.
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.
When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.
4. Conveying Verbatim Copies.
You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.
5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:
a) The work must carry prominent notices stating that you modified
it, and giving a relevant date.
b) The work must carry prominent notices stating that it is
released under this License and any conditions added under section
7. This requirement modifies the requirement in section 4 to
"keep intact all notices".
c) You must license the entire work, as a whole, under this
License to anyone who comes into possession of a copy. This
License will therefore apply, along with any applicable section 7
additional terms, to the whole of the work, and all its parts,
regardless of how they are packaged. This License gives no
permission to license the work in any other way, but it does not
invalidate such permission if you have separately received it.
d) If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your
work need not make them do so.
A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit. Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.
6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:
a) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by the
Corresponding Source fixed on a durable physical medium
customarily used for software interchange.
b) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by a
written offer, valid for at least three years and valid for as
long as you offer spare parts or customer support for that product
model, to give anyone who possesses the object code either (1) a
copy of the Corresponding Source for all the software in the
product that is covered by this License, on a durable physical
medium customarily used for software interchange, for a price no
more than your reasonable cost of physically performing this
conveying of source, or (2) access to copy the
Corresponding Source from a network server at no charge.
c) Convey individual copies of the object code with a copy of the
written offer to provide the Corresponding Source. This
alternative is allowed only occasionally and noncommercially, and
only if you received the object code with such an offer, in accord
with subsection 6b.
d) Convey the object code by offering access from a designated
place (gratis or for a charge), and offer equivalent access to the
Corresponding Source in the same way through the same place at no
further charge. You need not require recipients to copy the
Corresponding Source along with the object code. If the place to
copy the object code is a network server, the Corresponding Source
may be on a different server (operated by you or a third party)
that supports equivalent copying facilities, provided you maintain
clear directions next to the object code saying where to find the
Corresponding Source. Regardless of what server hosts the
Corresponding Source, you remain obligated to ensure that it is
available for as long as needed to satisfy these requirements.
e) Convey the object code using peer-to-peer transmission, provided
you inform other peers where the object code and Corresponding
Source of the work are being offered to the general public at no
charge under subsection 6d.
A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.
A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling. In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage. For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product. A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.
"Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source. The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.
If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information. But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).
The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed. Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.
Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.
7. Additional Terms.
"Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law. If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it. (Additional permissions may be written to require their own
removal in certain cases when you modify the work.) You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.
Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:
a) Disclaiming warranty or limiting liability differently from the
terms of sections 15 and 16 of this License; or
b) Requiring preservation of specified reasonable legal notices or
author attributions in that material or in the Appropriate Legal
Notices displayed by works containing it; or
c) Prohibiting misrepresentation of the origin of that material, or
requiring that modified versions of such material be marked in
reasonable ways as different from the original version; or
d) Limiting the use for publicity purposes of names of licensors or
authors of the material; or
e) Declining to grant rights under trademark law for use of some
trade names, trademarks, or service marks; or
f) Requiring indemnification of licensors and authors of that
material by anyone who conveys the material (or modified versions of
it) with contractual assumptions of liability to the recipient, for
any liability that these contractual assumptions directly impose on
those licensors and authors.
All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10. If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term. If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.
8. Termination.
You may not propagate or modify a covered work except as expressly
provided under this License. Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).
However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.
9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or
run a copy of the Program. Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance. However,
nothing other than this License grants you permission to propagate or
modify any covered work. These actions infringe copyright if you do
not accept this License. Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.
10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License. You are not responsible
for enforcing compliance by third parties with this License.
An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations. If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License. For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.
11. Patents.
A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The
work thus licensed is called the contributor's "contributor version".
A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version. For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.
Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.
In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement). To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.
If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients. "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.
A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License. You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.
12. No Surrender of Others' Freedom.
If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all. For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.
13. Use with the GNU Affero General Public License.
Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU Affero General Public License into a single
combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work,
but the special requirements of the GNU Affero General Public License,
section 13, concerning interaction through a network will apply to the
combination as such.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of
the GNU General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the
Program specifies that a certain numbered version of the GNU General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation. If the Program does not specify a version number of the
GNU General Public License, you may choose any version ever published
by the Free Software Foundation.
If the Program specifies that a proxy can decide which future
versions of the GNU General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.
Later license versions may give you additional or different
permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.
15. Disclaimer of Warranty.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.
17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Also add information on how to contact you by electronic and paper mail.
If the program does terminal interaction, make it output a short
notice like this when it starts in an interactive mode:
<program> Copyright (C) <year> <name of author>
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, your program's commands
might be different; for a GUI interface, you would use an "about box".
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU GPL, see
<http://www.gnu.org/licenses/>.
The GNU General Public License does not permit incorporating your program
into proprietary programs. If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with
the library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. But first, please read
<http://www.gnu.org/philosophy/why-not-lgpl.html>.

View File

@ -1,6 +1,6 @@
{% if cookiecutter.open_source_license == 'MIT' %} {% if cookiecutter.open_source_license == 'MIT' %}
The MIT License (MIT) The MIT License (MIT)
Copyright (c) {{ cookiecutter.year }}, {{ cookiecutter.author_name }} Copyright (c) {% now 'utc', '%Y' %}, {{ cookiecutter.author_name }}
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
@ -8,7 +8,7 @@ The above copyright notice and this permission notice shall be included in all c
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
{% elif cookiecutter.open_source_license == 'BSD' %} {% elif cookiecutter.open_source_license == 'BSD' %}
Copyright (c) {{ cookiecutter.year }}, {{ cookiecutter.author_name }} Copyright (c) {% now 'utc', '%Y' %}, {{ cookiecutter.author_name }}
All rights reserved. All rights reserved.
Redistribution and use in source and binary forms, with or without modification, Redistribution and use in source and binary forms, with or without modification,
@ -35,4 +35,19 @@ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
OF THE POSSIBILITY OF SUCH DAMAGE. OF THE POSSIBILITY OF SUCH DAMAGE.
{% elif cookiecutter.open_source_license == 'GPLv3' %}
Copyright (c) {% now 'utc', '%Y' %}, {{ cookiecutter.author_name }}
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
{% endif %} {% endif %}

View File

@ -1,4 +1,4 @@
web: gunicorn config.wsgi:application web: gunicorn config.wsgi:application
{% if cookiecutter.use_celery == "y" -%} {% if cookiecutter.use_celery == "y" -%}
worker: {% if cookiecutter.use_newrelic == "y" %}newrelic-admin run-program {% endif %}celery worker --app={{cookiecutter.project_slug}}.taskapp --loglevel=info worker: celery worker --app={{cookiecutter.project_slug}}.taskapp --loglevel=info
{%- endif %} {%- endif %}

View File

@ -1,18 +1,18 @@
{{cookiecutter.project_name}} {{cookiecutter.project_name}}
============================== {{ '=' * cookiecutter.project_name|length }}
{{cookiecutter.description}} {{cookiecutter.description}}
.. image:: https://img.shields.io/badge/built%20with-Cookiecutter%20Django-ff69b4.svg .. image:: https://img.shields.io/badge/built%20with-Cookiecutter%20Django-ff69b4.svg
:target: https://github.com/pydanny/cookiecutter-django/ :target: https://github.com/pydanny/cookiecutter-django/
:alt: Built with Cookiecutter Django :alt: Built with Cookiecutter Django
{% if cookiecutter.open_source_license != "Not open source" %} {% if cookiecutter.open_source_license != "Not open source" %}
LICENSE: {{cookiecutter.open_source_license}}
:License: {{cookiecutter.open_source_license}}
{% endif %} {% endif %}
Settings Settings
------------ --------
Moved to settings_. Moved to settings_.
@ -42,7 +42,7 @@ To run the tests, check your test coverage, and generate an HTML coverage report
$ open htmlcov/index.html $ open htmlcov/index.html
Running tests with py.test Running tests with py.test
~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~
:: ::
@ -72,7 +72,6 @@ To run a celery worker:
Please note: For Celery's import magic to work, it is important *where* the celery commands are run. If you are in the same folder with *manage.py*, you should be right. Please note: For Celery's import magic to work, it is important *where* the celery commands are run. If you are in the same folder with *manage.py*, you should be right.
{% endif %} {% endif %}
{% if cookiecutter.use_mailhog == "y" %} {% if cookiecutter.use_mailhog == "y" %}
Email Server Email Server
@ -103,23 +102,21 @@ To view messages that are sent by your application, open your browser and go to
The email server will exit when you exit the Grunt task on the CLI with Ctrl+C. The email server will exit when you exit the Grunt task on the CLI with Ctrl+C.
{% endif %} {% endif %}
{% endif %} {% endif %}
{% if cookiecutter.use_sentry_for_error_reporting == "y" %}
{% if cookiecutter.use_sentry == "y" %}
Sentry Sentry
^^^^^^ ^^^^^^
Sentry is an error logging aggregator service. You can sign up for a free account at http://getsentry.com or download and host it yourself. Sentry is an error logging aggregator service. You can sign up for a free account at https://getsentry.com/signup/?code=cookiecutter or download and host it yourself.
The system is setup with reasonable defaults, including 404 logging and integration with the WSGI application. The system is setup with reasonable defaults, including 404 logging and integration with the WSGI application.
You must set the DSN url in production. You must set the DSN url in production.
{% endif %} {% endif %}
Deployment Deployment
---------- ----------
The following details how to deploy this application.
{% if cookiecutter.use_heroku == "y" %} {% if cookiecutter.use_heroku == "y" %}
Heroku Heroku
@ -131,9 +128,7 @@ Heroku
See detailed `cookiecutter-django Heroku documentation`_. See detailed `cookiecutter-django Heroku documentation`_.
.. _`cookiecutter-django Heroku documentation`: http://cookiecutter-django.readthedocs.io/en/latest/deployment-on-heroku.html .. _`cookiecutter-django Heroku documentation`: http://cookiecutter-django.readthedocs.io/en/latest/deployment-on-heroku.html
{% endif %} {% endif %}
{% if cookiecutter.use_docker == "y" %} {% if cookiecutter.use_docker == "y" %}
Docker Docker
@ -142,5 +137,4 @@ Docker
See detailed `cookiecutter-django Docker documentation`_. See detailed `cookiecutter-django Docker documentation`_.
.. _`cookiecutter-django Docker documentation`: http://cookiecutter-django.readthedocs.io/en/latest/deployment-with-docker.html .. _`cookiecutter-django Docker documentation`: http://cookiecutter-django.readthedocs.io/en/latest/deployment-with-docker.html
{% endif %} {% endif %}

View File

@ -20,18 +20,19 @@
"DJANGO_AWS_SECRET_ACCESS_KEY": "", "DJANGO_AWS_SECRET_ACCESS_KEY": "",
"DJANGO_AWS_STORAGE_BUCKET_NAME": "", "DJANGO_AWS_STORAGE_BUCKET_NAME": "",
"DJANGO_MAILGUN_SERVER_NAME": "", "DJANGO_MAILGUN_SERVER_NAME": "",
{% if cookiecutter.use_newrelic == "y" -%} "DJANGO_MAILGUN_API_KEY": ""{% if cookiecutter.use_sentry_for_error_reporting == "y" -%},
"NEW_RELIC_LICENSE_KEY": "", "DJANGO_SENTRY_DSN": ""{%- endif %}
"NEW_RELIC_APP_NAME": "",
{%- endif %}
"DJANGO_MAILGUN_API_KEY": ""{% if cookiecutter.use_sentry == "y" -%},
"DJANGO_SENTRY_DSN": ""{%- endif %}
}, },
"scripts": { "scripts": {
"postdeploy": "python manage.py migrate" "postdeploy": "python manage.py migrate"
}, },
"addons": [ "addons": [
"heroku-postgresql:hobby-dev", {
"plan": "heroku-postgresql:hobby-dev",
"options": {
"version": "{{ cookiecutter.postgresql_version }}"
}
},
"heroku-redis:hobby-dev", "heroku-redis:hobby-dev",
"mailgun" "mailgun"
] ]

View File

@ -1,4 +1,4 @@
{% if cookiecutter.use_python2 == 'n' -%} {% if cookiecutter.use_python3 == 'y' -%}
FROM python:3.5 FROM python:3.5
{% else %} {% else %}
FROM python:2.7 FROM python:2.7
@ -8,18 +8,21 @@ ENV PYTHONUNBUFFERED 1
# Requirements have to be pulled and installed here, otherwise caching won't work # Requirements have to be pulled and installed here, otherwise caching won't work
COPY ./requirements /requirements COPY ./requirements /requirements
RUN pip install -r /requirements/production.txt RUN pip install -r /requirements/production.txt \
&& groupadd -r django \
&& useradd -r -g django django
RUN groupadd -r django && useradd -r -g django django
COPY . /app COPY . /app
RUN chown -R django /app RUN chown -R django /app
COPY ./compose/django/gunicorn.sh /gunicorn.sh COPY ./compose/django/gunicorn.sh /gunicorn.sh
COPY ./compose/django/entrypoint.sh /entrypoint.sh COPY ./compose/django/entrypoint.sh /entrypoint.sh
RUN sed -i 's/\r//' /entrypoint.sh RUN sed -i 's/\r//' /entrypoint.sh \
RUN sed -i 's/\r//' /gunicorn.sh && sed -i 's/\r//' /gunicorn.sh \
RUN chmod +x /entrypoint.sh && chown django /entrypoint.sh && chmod +x /entrypoint.sh \
RUN chmod +x /gunicorn.sh && chown django /gunicorn.sh && chown django /entrypoint.sh \
&& chmod +x /gunicorn.sh \
&& chown django /gunicorn.sh
WORKDIR /app WORKDIR /app

View File

@ -1,4 +1,4 @@
{% if cookiecutter.use_python2 == 'n' -%} {% if cookiecutter.use_python3 == 'y' -%}
FROM python:3.5 FROM python:3.5
{% else %} {% else %}
FROM python:2.7 FROM python:2.7
@ -13,6 +13,10 @@ COPY ./compose/django/entrypoint.sh /entrypoint.sh
RUN sed -i 's/\r//' /entrypoint.sh RUN sed -i 's/\r//' /entrypoint.sh
RUN chmod +x /entrypoint.sh RUN chmod +x /entrypoint.sh
COPY ./compose/django/start-dev.sh /start-dev.sh
RUN sed -i 's/\r//' /start-dev.sh
RUN chmod +x /start-dev.sh
WORKDIR /app WORKDIR /app
ENTRYPOINT ["/entrypoint.sh"] ENTRYPOINT ["/entrypoint.sh"]

View File

@ -1,5 +1,7 @@
#!/bin/bash #!/bin/bash
set -e set -e
cmd="$@"
# This entrypoint is used to play nicely with the current cookiecutter configuration. # This entrypoint is used to play nicely with the current cookiecutter configuration.
# Since docker-compose relies heavily on environment variables itself for configuration, we'd have to define multiple # Since docker-compose relies heavily on environment variables itself for configuration, we'd have to define multiple
# environment variables just to support cookiecutter out of the box. That makes no sense, so this little entrypoint # environment variables just to support cookiecutter out of the box. That makes no sense, so this little entrypoint
@ -15,4 +17,23 @@ export DATABASE_URL=postgres://$POSTGRES_USER:$POSTGRES_PASSWORD@postgres:5432/$
{% if cookiecutter.use_celery == 'y' %} {% if cookiecutter.use_celery == 'y' %}
export CELERY_BROKER_URL=$REDIS_URL/0 export CELERY_BROKER_URL=$REDIS_URL/0
{% endif %} {% endif %}
exec "$@"
function postgres_ready(){
python << END
import sys
import psycopg2
try:
conn = psycopg2.connect(dbname="$POSTGRES_USER", user="$POSTGRES_USER", password="$POSTGRES_PASSWORD", host="postgres")
except psycopg2.OperationalError:
sys.exit(-1)
sys.exit(0)
END
}
until postgres_ready; do
>&2 echo "Postgres is unavailable - sleeping"
sleep 1
done
>&2 echo "Postgres is up - continuing..."
exec $cmd

View File

@ -0,0 +1,3 @@
#!/bin/sh
python manage.py migrate
python manage.py runserver_plus 0.0.0.0:8000

View File

@ -1,2 +1,9 @@
FROM nginx:latest FROM nginx:latest
ADD nginx.conf /etc/nginx/nginx.conf ADD nginx.conf /etc/nginx/nginx.conf
{% if cookiecutter.use_lets_encrypt == 'y' and cookiecutter.use_docker == 'y' %}
ADD start.sh /start.sh
ADD nginx-secure.conf /etc/nginx/nginx-secure.conf
ADD dhparams.pem /etc/ssl/private/dhparams.pem
CMD /start.sh
{% endif %}

View File

@ -0,0 +1,3 @@
-----BEGIN DH PARAMETERS-----
EXAMPLE_FILE
-----END DH PARAMETERS-----

View File

@ -0,0 +1,96 @@
user nginx;
worker_processes 1;
error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log /var/log/nginx/access.log main;
sendfile on;
#tcp_nopush on;
keepalive_timeout 65;
proxy_headers_hash_bucket_size 52;
gzip on;
upstream app {
server django:5000;
}
server {
listen 80;
server_name ___my.example.com___ www.___my.example.com___;
location /.well-known/acme-challenge {
# Since the certbot container isn't up constantly, need to resolve ip dynamically using docker's dns
resolver ___NAMESERVER___;
set $certbot_addr_port certbot:80;
proxy_pass http://$certbot_addr_port;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header X-Forwarded-Proto $scheme;
}
location / {
return 301 https://$server_name$request_uri;
}
}
server {
listen 443;
server_name ___my.example.com___ www.___my.example.com___;
ssl on;
ssl_certificate /etc/letsencrypt/live/___my.example.com___/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/___my.example.com___/privkey.pem;
ssl_session_timeout 5m;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers 'EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH';
ssl_prefer_server_ciphers on;
ssl_session_cache shared:SSL:10m;
ssl_dhparam /etc/ssl/private/dhparams.pem;
location /.well-known/acme-challenge {
resolver ___NAMESERVER___;
set $certbot_addr_port certbot:443;
proxy_pass http://$certbot_addr_port;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header X-Forwarded-Proto https;
}
location / {
# checks for static file, if not found proxy to app
try_files $uri @proxy_to_app;
}
# cookiecutter-django app
location @proxy_to_app {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_redirect off;
proxy_pass http://app;
}
}
}

View File

@ -9,9 +9,9 @@ events {
worker_connections 1024; worker_connections 1024;
} }
http { http {
include /etc/nginx/mime.types;
include /etc/nginx/mime.types;
default_type application/octet-stream; default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] "$request" ' log_format main '$remote_addr - $remote_user [$time_local] "$request" '
@ -31,23 +31,40 @@ http {
server django:5000; server django:5000;
} }
server { server {
listen 80; listen 80;
charset utf-8; charset utf-8;
{% if cookiecutter.use_lets_encrypt == 'y' and cookiecutter.use_docker == 'y' %}
server_name ___my.example.com___ ;
location / { location /.well-known/acme-challenge {
proxy_pass http://certbot:80;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header X-Forwarded-Proto https;
}
{% endif %}
location / {
# checks for static file, if not found proxy to app # checks for static file, if not found proxy to app
try_files $uri @proxy_to_app; try_files $uri @proxy_to_app;
} }
location @proxy_to_app {
# cookiecutter-django app
location @proxy_to_app {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host; proxy_set_header Host $http_host;
proxy_redirect off; proxy_redirect off;
proxy_pass http://app; proxy_pass http://app;
}
} }
} }
}

View File

@ -0,0 +1,62 @@
echo sleep 5
sleep 5
echo build starting nginx config
echo replacing ___my.example.com___/$MY_DOMAIN_NAME
# Put your domain name into the nginx reverse proxy config.
sed -i "s/___my.example.com___/$MY_DOMAIN_NAME/g" /etc/nginx/nginx.conf
cat /etc/nginx/nginx.conf
echo .
echo Firing up nginx in the background.
nginx
# # Check user has specified domain name
if [ -z "$MY_DOMAIN_NAME" ]; then
echo "Need to set MY_DOMAIN_NAME (to a letsencrypt-registered name)."
exit 1
fi
# This bit waits until the letsencrypt container has done its thing.
# We see the changes here bceause there's a docker volume mapped.
echo Waiting for folder /etc/letsencrypt/live/$MY_DOMAIN_NAME to exist
while [ ! -d /etc/letsencrypt/live/$MY_DOMAIN_NAME ] ;
do
sleep 2
done
while [ ! -f /etc/letsencrypt/live/$MY_DOMAIN_NAME/fullchain.pem ] ;
do
echo Waiting for file fullchain.pem to exist
sleep 2
done
while [ ! -f /etc/letsencrypt/live/$MY_DOMAIN_NAME/privkey.pem ] ;
do
echo Waiting for file privkey.pem to exist
sleep 2
done
# This is added so that when the certificate is being renewed or is already in place, nginx waits for everything to be good.
sleep 15
echo replacing ___my.example.com___/$MY_DOMAIN_NAME
# Put your domain name into the nginx reverse proxy config.
sed -i "s/___my.example.com___/$MY_DOMAIN_NAME/g" /etc/nginx/nginx-secure.conf
# Add the system's nameserver (the docker network dns) so we can resolve container names in nginx
NAMESERVER=`cat /etc/resolv.conf | grep "nameserver" | awk '{print $2}' | tr '\n' ' '`
echo replacing ___NAMESERVER___/$NAMESERVER
sed -i "s/___NAMESERVER___/$NAMESERVER/g" /etc/nginx/nginx-secure.conf
#go!
kill $(ps aux | grep 'nginx' | grep -v 'grep' | awk '{print $2}')
cp /etc/nginx/nginx-secure.conf /etc/nginx/nginx.conf
nginx -g 'daemon off;'

View File

@ -1,4 +1,4 @@
FROM postgres:9.5 FROM postgres:{{ cookiecutter.postgresql_version }}
# add backup scripts # add backup scripts
ADD backup.sh /usr/local/bin/backup ADD backup.sh /usr/local/bin/backup

View File

@ -16,7 +16,7 @@ export PGPASSWORD=$POSTGRES_PASSWORD
echo "creating backup" echo "creating backup"
echo "---------------" echo "---------------"
FILENAME=backup_$(date +'%Y_%m_%dT%H_%M_%S').sql FILENAME=backup_$(date +'%Y_%m_%dT%H_%M_%S').sql.gz
pg_dump -h postgres -U $POSTGRES_USER >> /backups/$FILENAME pg_dump -h postgres -U $POSTGRES_USER | gzip > /backups/$FILENAME
echo "successfully created backup $FILENAME" echo "successfully created backup $FILENAME"

View File

@ -53,4 +53,4 @@ createdb -h postgres -U $POSTGRES_USER $POSTGRES_USER -O $POSTGRES_USER
# restore the database # restore the database
echo "restoring database $POSTGRES_USER" echo "restoring database $POSTGRES_USER"
psql -h postgres -U $POSTGRES_USER < $BACKUPFILE gunzip -c $BACKUPFILE | psql -h postgres -U $POSTGRES_USER

View File

@ -43,7 +43,8 @@ THIRD_PARTY_APPS = (
# Apps specific for this project go here. # Apps specific for this project go here.
LOCAL_APPS = ( LOCAL_APPS = (
'{{ cookiecutter.project_slug }}.users', # custom users app # custom users app
'{{ cookiecutter.project_slug }}.users.apps.UsersConfig',
# Your stuff: custom apps go here # Your stuff: custom apps go here
) )
@ -53,7 +54,7 @@ INSTALLED_APPS = DJANGO_APPS + THIRD_PARTY_APPS + LOCAL_APPS
# MIDDLEWARE CONFIGURATION # MIDDLEWARE CONFIGURATION
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
MIDDLEWARE_CLASSES = ( MIDDLEWARE_CLASSES = (
# Make sure djangosecure.middleware.SecurityMiddleware is listed first 'django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware', 'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware', 'django.middleware.csrf.CsrfViewMiddleware',
@ -98,7 +99,6 @@ MANAGERS = ADMINS
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
# See: https://docs.djangoproject.com/en/dev/ref/settings/#databases # See: https://docs.djangoproject.com/en/dev/ref/settings/#databases
DATABASES = { DATABASES = {
# Raises ImproperlyConfigured exception if DATABASE_URL not in os.environ
'default': env.db('DATABASE_URL', default='postgres://{% if cookiecutter.windows == 'y' %}localhost{% endif %}/{{cookiecutter.project_slug}}'), 'default': env.db('DATABASE_URL', default='postgres://{% if cookiecutter.windows == 'y' %}localhost{% endif %}/{{cookiecutter.project_slug}}'),
} }
DATABASES['default']['ATOMIC_REQUESTS'] = True DATABASES['default']['ATOMIC_REQUESTS'] = True
@ -164,7 +164,7 @@ TEMPLATES = [
] ]
# See: http://django-crispy-forms.readthedocs.io/en/latest/install.html#template-packs # See: http://django-crispy-forms.readthedocs.io/en/latest/install.html#template-packs
CRISPY_TEMPLATE_PACK = 'bootstrap3' CRISPY_TEMPLATE_PACK = 'bootstrap4'
# STATIC FILE CONFIGURATION # STATIC FILE CONFIGURATION
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
@ -230,10 +230,22 @@ INSTALLED_APPS += ('{{cookiecutter.project_slug}}.taskapp.celery.CeleryConfig',)
# if you are not using the django database broker (e.g. rabbitmq, redis, memcached), you can remove the next line. # if you are not using the django database broker (e.g. rabbitmq, redis, memcached), you can remove the next line.
INSTALLED_APPS += ('kombu.transport.django',) INSTALLED_APPS += ('kombu.transport.django',)
BROKER_URL = env('CELERY_BROKER_URL', default='django://') BROKER_URL = env('CELERY_BROKER_URL', default='django://')
if BROKER_URL == 'django://':
CELERY_RESULT_BACKEND = 'redis://'
else:
CELERY_RESULT_BACKEND = BROKER_URL
########## END CELERY ########## END CELERY
{% endif %} {% endif %}
{%- if cookiecutter.use_compressor == 'y'-%}
# django-compressor
# ------------------------------------------------------------------------------
INSTALLED_APPS += ("compressor", )
STATICFILES_FINDERS += ("compressor.finders.CompressorFinder", )
{%- endif %}
# Location of root django.contrib.admin URL, use {% raw %}{% url 'admin:index' %}{% endraw %} # Location of root django.contrib.admin URL, use {% raw %}{% url 'admin:index' %}{% endraw %}
ADMIN_URL = r'^admin/' ADMIN_URL = r'^admin/'
# Your common stuff: Below this line define 3rd party library settings # Your common stuff: Below this line define 3rd party library settings
# ------------------------------------------------------------------------------

View File

@ -3,11 +3,17 @@
Local settings Local settings
- Run in Debug mode - Run in Debug mode
{% if cookiecutter.use_mailhog == 'y' and cookiecutter.use_docker == 'y' %}
- Use mailhog for emails
{% else %}
- Use console backend for emails - Use console backend for emails
{% endif %}
- Add Django Debug Toolbar - Add Django Debug Toolbar
- Add django-extensions as app - Add django-extensions as app
""" """
import socket
import os
from .common import * # noqa from .common import * # noqa
# DEBUG # DEBUG
@ -49,7 +55,11 @@ CACHES = {
MIDDLEWARE_CLASSES += ('debug_toolbar.middleware.DebugToolbarMiddleware',) MIDDLEWARE_CLASSES += ('debug_toolbar.middleware.DebugToolbarMiddleware',)
INSTALLED_APPS += ('debug_toolbar', ) INSTALLED_APPS += ('debug_toolbar', )
INTERNAL_IPS = ('127.0.0.1', '10.0.2.2',) INTERNAL_IPS = ['127.0.0.1', '10.0.2.2', ]
# tricks to have debug toolbar when developing with docker
if os.environ.get('USE_DOCKER') == 'yes':
ip = socket.gethostbyname(socket.gethostname())
INTERNAL_IPS += [ip[:-1] + "1"]
DEBUG_TOOLBAR_CONFIG = { DEBUG_TOOLBAR_CONFIG = {
'DISABLE_PANELS': [ 'DISABLE_PANELS': [
@ -72,3 +82,4 @@ CELERY_ALWAYS_EAGER = True
########## END CELERY ########## END CELERY
{% endif %} {% endif %}
# Your local stuff: Below this line define 3rd party library settings # Your local stuff: Below this line define 3rd party library settings
# ------------------------------------------------------------------------------

View File

@ -2,11 +2,10 @@
""" """
Production Configurations Production Configurations
- Use djangosecure
- Use Amazon's S3 for storing static files and uploaded media - Use Amazon's S3 for storing static files and uploaded media
- Use mailgun to send emails - Use mailgun to send emails
- Use Redis on Heroku - Use Redis for cache
{% if cookiecutter.use_sentry == 'y' %} {% if cookiecutter.use_sentry_for_error_reporting == 'y' %}
- Use sentry for error logging - Use sentry for error logging
{% endif %} {% endif %}
{% if cookiecutter.use_opbeat == 'y' %} {% if cookiecutter.use_opbeat == 'y' %}
@ -17,7 +16,7 @@ from __future__ import absolute_import, unicode_literals
from boto.s3.connection import OrdinaryCallingFormat from boto.s3.connection import OrdinaryCallingFormat
from django.utils import six from django.utils import six
{% if cookiecutter.use_sentry == 'y' %} {% if cookiecutter.use_sentry_for_error_reporting == 'y' %}
import logging import logging
{% endif %} {% endif %}
@ -29,40 +28,27 @@ from .common import * # noqa
# Raises ImproperlyConfigured exception if DJANGO_SECRET_KEY not in os.environ # Raises ImproperlyConfigured exception if DJANGO_SECRET_KEY not in os.environ
SECRET_KEY = env('DJANGO_SECRET_KEY') SECRET_KEY = env('DJANGO_SECRET_KEY')
# This ensures that Django will be able to detect a secure connection # This ensures that Django will be able to detect a secure connection
# properly on Heroku. # properly on Heroku.
SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https') SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https')
# django-secure {%- if cookiecutter.use_sentry_for_error_reporting == 'y' %}
# ------------------------------------------------------------------------------
INSTALLED_APPS += ('djangosecure', )
{% if cookiecutter.use_sentry == 'y' -%}
# raven sentry client # raven sentry client
# See https://docs.getsentry.com/hosted/clients/python/integrations/django/ # See https://docs.getsentry.com/hosted/clients/python/integrations/django/
INSTALLED_APPS += ('raven.contrib.django.raven_compat', ) INSTALLED_APPS += ('raven.contrib.django.raven_compat', )
{%- endif %} {% endif %}
SECURITY_MIDDLEWARE = ( {%- if cookiecutter.use_whitenoise == 'y' %}
'djangosecure.middleware.SecurityMiddleware',
)
{% if cookiecutter.use_whitenoise == 'y' -%}
# Use Whitenoise to serve static files # Use Whitenoise to serve static files
# See: https://whitenoise.readthedocs.io/ # See: https://whitenoise.readthedocs.io/
WHITENOISE_MIDDLEWARE = ( WHITENOISE_MIDDLEWARE = ('whitenoise.middleware.WhiteNoiseMiddleware', )
'whitenoise.middleware.WhiteNoiseMiddleware',
)
MIDDLEWARE_CLASSES = WHITENOISE_MIDDLEWARE + MIDDLEWARE_CLASSES MIDDLEWARE_CLASSES = WHITENOISE_MIDDLEWARE + MIDDLEWARE_CLASSES
{%- endif %} {% endif %}
{% if cookiecutter.use_sentry == 'y' -%} {%- if cookiecutter.use_sentry_for_error_reporting == 'y' -%}
RAVEN_MIDDLEWARE = ( RAVEN_MIDDLEWARE = ('raven.contrib.django.raven_compat.middleware.SentryResponseErrorIdMiddleware', )
'raven.contrib.django.raven_compat.middleware.SentryResponseErrorIdMiddleware',
)
MIDDLEWARE_CLASSES = RAVEN_MIDDLEWARE + MIDDLEWARE_CLASSES MIDDLEWARE_CLASSES = RAVEN_MIDDLEWARE + MIDDLEWARE_CLASSES
{%- endif %} {% endif %}
{%- if cookiecutter.use_opbeat == 'y' -%}
# Make sure djangosecure.middleware.SecurityMiddleware is listed first
MIDDLEWARE_CLASSES = SECURITY_MIDDLEWARE + MIDDLEWARE_CLASSES
{% if cookiecutter.use_opbeat == 'y' -%}
# opbeat integration # opbeat integration
# See https://opbeat.com/languages/django/ # See https://opbeat.com/languages/django/
INSTALLED_APPS += ('opbeat.contrib.django',) INSTALLED_APPS += ('opbeat.contrib.django',)
@ -74,7 +60,13 @@ OPBEAT = {
MIDDLEWARE_CLASSES = ( MIDDLEWARE_CLASSES = (
'opbeat.contrib.django.middleware.OpbeatAPMMiddleware', 'opbeat.contrib.django.middleware.OpbeatAPMMiddleware',
) + MIDDLEWARE_CLASSES ) + MIDDLEWARE_CLASSES
{%- endif %} {% endif %}
# SECURITY CONFIGURATION
# ------------------------------------------------------------------------------
# See https://docs.djangoproject.com/en/1.9/ref/middleware/#module-django.middleware.security
# and https://docs.djangoproject.com/ja/1.9/howto/deployment/checklist/#run-manage-py-check-deploy
# set this to 60 seconds and then to 518400 when you can prove it works # set this to 60 seconds and then to 518400 when you can prove it works
SECURE_HSTS_SECONDS = 60 SECURE_HSTS_SECONDS = 60
SECURE_HSTS_INCLUDE_SUBDOMAINS = env.bool( SECURE_HSTS_INCLUDE_SUBDOMAINS = env.bool(
@ -82,9 +74,12 @@ SECURE_HSTS_INCLUDE_SUBDOMAINS = env.bool(
SECURE_CONTENT_TYPE_NOSNIFF = env.bool( SECURE_CONTENT_TYPE_NOSNIFF = env.bool(
'DJANGO_SECURE_CONTENT_TYPE_NOSNIFF', default=True) 'DJANGO_SECURE_CONTENT_TYPE_NOSNIFF', default=True)
SECURE_BROWSER_XSS_FILTER = True SECURE_BROWSER_XSS_FILTER = True
SESSION_COOKIE_SECURE = False SESSION_COOKIE_SECURE = True
SESSION_COOKIE_HTTPONLY = True SESSION_COOKIE_HTTPONLY = True
SECURE_SSL_REDIRECT = env.bool('DJANGO_SECURE_SSL_REDIRECT', default=True) SECURE_SSL_REDIRECT = env.bool('DJANGO_SECURE_SSL_REDIRECT', default=True)
CSRF_COOKIE_SECURE = True
CSRF_COOKIE_HTTPONLY = True
X_FRAME_OPTIONS = 'DENY'
# SITE CONFIGURATION # SITE CONFIGURATION
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
@ -95,6 +90,7 @@ ALLOWED_HOSTS = env.list('DJANGO_ALLOWED_HOSTS', default=['{{cookiecutter.domain
INSTALLED_APPS += ('gunicorn', ) INSTALLED_APPS += ('gunicorn', )
# STORAGE CONFIGURATION # STORAGE CONFIGURATION
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
# Uploaded Media Files # Uploaded Media Files
@ -143,27 +139,32 @@ STATICFILES_STORAGE = 'whitenoise.storage.CompressedManifestStaticFilesStorage'
{% else %} {% else %}
STATIC_URL = 'https://s3.amazonaws.com/%s/static/' % AWS_STORAGE_BUCKET_NAME STATIC_URL = 'https://s3.amazonaws.com/%s/static/' % AWS_STORAGE_BUCKET_NAME
STATICFILES_STORAGE = 'config.settings.production.StaticRootS3BotoStorage' STATICFILES_STORAGE = 'config.settings.production.StaticRootS3BotoStorage'
# See: https://github.com/antonagestam/collectfast # See: https://github.com/antonagestam/collectfast
# For Django 1.7+, 'collectfast' should come before # For Django 1.7+, 'collectfast' should come before
# 'django.contrib.staticfiles' # 'django.contrib.staticfiles'
AWS_PRELOAD_METADATA = True AWS_PRELOAD_METADATA = True
INSTALLED_APPS = ('collectfast', ) + INSTALLED_APPS INSTALLED_APPS = ('collectfast', ) + INSTALLED_APPS
{%- endif %} {%- endif %}
{% if cookiecutter.use_compressor == 'y'-%}
# COMPRESSOR
# ------------------------------------------------------------------------------
COMPRESS_STORAGE = 'storages.backends.s3boto.S3BotoStorage'
COMPRESS_URL = STATIC_URL
COMPRESS_ENABLED = env.bool('COMPRESS_ENABLED', default=True)
{%- endif %}
# EMAIL # EMAIL
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
DEFAULT_FROM_EMAIL = env('DJANGO_DEFAULT_FROM_EMAIL', DEFAULT_FROM_EMAIL = env('DJANGO_DEFAULT_FROM_EMAIL',
default='{{cookiecutter.project_name}} <noreply@{{cookiecutter.domain_name}}>') default='{{cookiecutter.project_name}} <noreply@{{cookiecutter.domain_name}}>')
EMAIL_BACKEND = 'django_mailgun.MailgunBackend'
MAILGUN_ACCESS_KEY = env('DJANGO_MAILGUN_API_KEY')
MAILGUN_SERVER_NAME = env('DJANGO_MAILGUN_SERVER_NAME')
EMAIL_SUBJECT_PREFIX = env('DJANGO_EMAIL_SUBJECT_PREFIX', default='[{{cookiecutter.project_name}}] ') EMAIL_SUBJECT_PREFIX = env('DJANGO_EMAIL_SUBJECT_PREFIX', default='[{{cookiecutter.project_name}}] ')
SERVER_EMAIL = env('DJANGO_SERVER_EMAIL', default=DEFAULT_FROM_EMAIL) SERVER_EMAIL = env('DJANGO_SERVER_EMAIL', default=DEFAULT_FROM_EMAIL)
{% if cookiecutter.use_newrelic == 'y'-%}
NEW_RELIC_LICENSE_KEY = env('NEW_RELIC_LICENSE_KEY') # Anymail with Mailgun
NEW_RELIC_APP_NAME = env('NEW_RELIC_APP_NAME') INSTALLED_APPS += ("anymail", )
{%- endif %} ANYMAIL = {
"MAILGUN_API_KEY": env('DJANGO_MAILGUN_API_KEY'),
}
EMAIL_BACKEND = "anymail.backends.mailgun.MailgunBackend"
# TEMPLATE CONFIGURATION # TEMPLATE CONFIGURATION
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
@ -194,7 +195,7 @@ CACHES = {
} }
} }
{% if cookiecutter.use_sentry == 'y' %} {% if cookiecutter.use_sentry_for_error_reporting == 'y' %}
# Sentry Configuration # Sentry Configuration
SENTRY_DSN = env('DJANGO_SENTRY_DSN') SENTRY_DSN = env('DJANGO_SENTRY_DSN')
SENTRY_CLIENT = env('DJANGO_SENTRY_CLIENT', default='raven.contrib.django.raven_compat.DjangoClient') SENTRY_CLIENT = env('DJANGO_SENTRY_CLIENT', default='raven.contrib.django.raven_compat.DjangoClient')
@ -250,7 +251,7 @@ RAVEN_CONFIG = {
'CELERY_LOGLEVEL': env.int('DJANGO_SENTRY_LOG_LEVEL', logging.INFO), 'CELERY_LOGLEVEL': env.int('DJANGO_SENTRY_LOG_LEVEL', logging.INFO),
'DSN': SENTRY_DSN 'DSN': SENTRY_DSN
} }
{% elif cookiecutter.use_sentry == 'n' %} {% elif cookiecutter.use_sentry_for_error_reporting == 'n' %}
# LOGGING CONFIGURATION # LOGGING CONFIGURATION
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
# See: https://docs.djangoproject.com/en/dev/ref/settings/#logging # See: https://docs.djangoproject.com/en/dev/ref/settings/#logging
@ -303,3 +304,4 @@ LOGGING = {
ADMIN_URL = env('DJANGO_ADMIN_URL') ADMIN_URL = env('DJANGO_ADMIN_URL')
# Your production stuff: Below this line define 3rd party library settings # Your production stuff: Below this line define 3rd party library settings
# ------------------------------------------------------------------------------

View File

@ -0,0 +1,62 @@
# -*- coding: utf-8 -*-
'''
Test settings
- Used to run tests fast on the continuous integration server and locally
'''
from .common import * # noqa
# DEBUG
# ------------------------------------------------------------------------------
# Turn debug off so tests run faster
DEBUG = False
TEMPLATES[0]['OPTIONS']['debug'] = False
# SECRET CONFIGURATION
# ------------------------------------------------------------------------------
# See: https://docs.djangoproject.com/en/dev/ref/settings/#secret-key
# Note: This key only used for development and testing.
SECRET_KEY = env('DJANGO_SECRET_KEY', default='CHANGEME!!!')
# Mail settings
# ------------------------------------------------------------------------------
EMAIL_HOST = 'localhost'
EMAIL_PORT = 1025
# In-memory email backend stores messages in django.core.mail.outbox
# for unit testing purposes
EMAIL_BACKEND = 'django.core.mail.backends.locmem.EmailBackend'
# CACHING
# ------------------------------------------------------------------------------
# Speed advantages of in-memory caching without having to run Memcached
CACHES = {
'default': {
'BACKEND': 'django.core.cache.backends.locmem.LocMemCache',
'LOCATION': ''
}
}
# TESTING
# ------------------------------------------------------------------------------
TEST_RUNNER = 'django.test.runner.DiscoverRunner'
# PASSWORD HASHING
# ------------------------------------------------------------------------------
# Use fast password hasher so tests run faster
PASSWORD_HASHERS = (
'django.contrib.auth.hashers.MD5PasswordHasher',
)
# TEMPLATE LOADERS
# ------------------------------------------------------------------------------
# Keep templates in memory so tests run faster
TEMPLATES[0]['OPTIONS']['loaders'] = [
('django.template.loaders.cached.Loader', [
'django.template.loaders.filesystem.Loader',
'django.template.loaders.app_directories.Loader',
]),
]

View File

@ -15,13 +15,8 @@ framework.
""" """
import os import os
{% if cookiecutter.use_newrelic == 'y' -%}
if os.environ.get('DJANGO_SETTINGS_MODULE') == 'config.settings.production':
import newrelic.agent
newrelic.agent.initialize()
{%- endif %}
from django.core.wsgi import get_wsgi_application from django.core.wsgi import get_wsgi_application
{% if cookiecutter.use_sentry == 'y' -%} {% if cookiecutter.use_sentry_for_error_reporting == 'y' -%}
if os.environ.get('DJANGO_SETTINGS_MODULE') == 'config.settings.production': if os.environ.get('DJANGO_SETTINGS_MODULE') == 'config.settings.production':
from raven.contrib.django.raven_compat.middleware.wsgi import Sentry from raven.contrib.django.raven_compat.middleware.wsgi import Sentry
{%- endif %} {%- endif %}
@ -36,14 +31,10 @@ os.environ.setdefault("DJANGO_SETTINGS_MODULE", "config.settings.production")
# file. This includes Django's development server, if the WSGI_APPLICATION # file. This includes Django's development server, if the WSGI_APPLICATION
# setting points here. # setting points here.
application = get_wsgi_application() application = get_wsgi_application()
{% if cookiecutter.use_sentry == 'y' -%} {% if cookiecutter.use_sentry_for_error_reporting == 'y' -%}
if os.environ.get('DJANGO_SETTINGS_MODULE') == 'config.settings.production': if os.environ.get('DJANGO_SETTINGS_MODULE') == 'config.settings.production':
application = Sentry(application) application = Sentry(application)
{%- endif %} {%- endif %}
{% if cookiecutter.use_newrelic == 'y' -%}
if os.environ.get('DJANGO_SETTINGS_MODULE') == 'config.settings.production':
application = newrelic.agent.WSGIApplicationWrapper(application)
{%- endif %}
# Apply WSGI middleware here. # Apply WSGI middleware here.
# from helloworld.wsgi import HelloWorldApplication # from helloworld.wsgi import HelloWorldApplication
# application = HelloWorldApplication(application) # application = HelloWorldApplication(application)

View File

@ -22,11 +22,12 @@ services:
build: build:
context: . context: .
dockerfile: ./compose/django/Dockerfile-dev dockerfile: ./compose/django/Dockerfile-dev
command: python /app/manage.py runserver_plus 0.0.0.0:8000 command: /start-dev.sh
depends_on: depends_on:
- postgres - postgres
environment: environment:
- POSTGRES_USER={{cookiecutter.project_slug}} - POSTGRES_USER={{cookiecutter.project_slug}}
- USE_DOCKER=yes
volumes: volumes:
- .:/app - .:/app
ports: ports:

View File

@ -27,12 +27,38 @@ services:
build: ./compose/nginx build: ./compose/nginx
depends_on: depends_on:
- django - django
{% if cookiecutter.use_lets_encrypt == 'y' %}
- certbot
{% endif %}
ports: ports:
- "0.0.0.0:80:80" - "0.0.0.0:80:80"
{% if cookiecutter.use_lets_encrypt == 'y' %}
environment:
- MY_DOMAIN_NAME={{ cookiecutter.domain_name }}
ports:
- "0.0.0.0:80:80"
- "0.0.0.0:443:443"
volumes:
- /etc/letsencrypt:/etc/letsencrypt
- /var/lib/letsencrypt:/var/lib/letsencrypt
certbot:
image: quay.io/letsencrypt/letsencrypt
command: bash -c "sleep 6 && certbot certonly -n --standalone -d {{ cookiecutter.domain_name }} --text --agree-tos --email {{ cookiecutter.email }} --server https://acme-v01.api.letsencrypt.org/directory --rsa-key-size 4096 --verbose --keep-until-expiring --standalone-supported-challenges http-01"
entrypoint: ""
volumes:
- /etc/letsencrypt:/etc/letsencrypt
- /var/lib/letsencrypt:/var/lib/letsencrypt
ports:
- "80"
- "443"
environment:
- TERM=xterm
{% endif %}
redis: redis:
image: redis:3.0 image: redis:latest
{% if cookiecutter.use_celery == 'y' %} {% if cookiecutter.use_celery == 'y' %}
celeryworker: celeryworker:
build: build:
context: . context: .
@ -54,4 +80,4 @@ services:
- postgres - postgres
- redis - redis
command: celery -A {{cookiecutter.project_slug}}.taskapp beat -l INFO command: celery -A {{cookiecutter.project_slug}}.taskapp beat -l INFO
{% endif %} {% endif %}

View File

@ -44,7 +44,7 @@ master_doc = 'index'
# General information about the project. # General information about the project.
project = '{{ cookiecutter.project_name }}' project = '{{ cookiecutter.project_name }}'
copyright = """{{ cookiecutter.year }}, {{ cookiecutter.author_name }}""" copyright = """{% now 'utc', '%Y' %}, {{ cookiecutter.author_name }}"""
# The version info for the project you're documenting, acts as replacement for # The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the # |version| and |release|, also used in various other places throughout the

View File

@ -1,27 +1,36 @@
# PostgreSQL
POSTGRES_PASSWORD=mysecretpass POSTGRES_PASSWORD=mysecretpass
POSTGRES_USER=postgresuser POSTGRES_USER=postgresuser
# General settings
DJANGO_ADMIN_URL= DJANGO_ADMIN_URL=
DJANGO_SETTINGS_MODULE=config.settings.production DJANGO_SETTINGS_MODULE=config.settings.production
DJANGO_SECRET_KEY=CHANGEME!!! DJANGO_SECRET_KEY=CHANGEME!!!
DJANGO_ALLOWED_HOSTS=.{{ cookiecutter.domain_name }} DJANGO_ALLOWED_HOSTS=.{{ cookiecutter.domain_name }}
# AWS Settings
DJANGO_AWS_ACCESS_KEY_ID= DJANGO_AWS_ACCESS_KEY_ID=
DJANGO_AWS_SECRET_ACCESS_KEY= DJANGO_AWS_SECRET_ACCESS_KEY=
DJANGO_AWS_STORAGE_BUCKET_NAME= DJANGO_AWS_STORAGE_BUCKET_NAME=
# Used with email
DJANGO_MAILGUN_API_KEY= DJANGO_MAILGUN_API_KEY=
DJANGO_MAILGUN_SERVER_NAME=
DJANGO_SERVER_EMAIL= DJANGO_SERVER_EMAIL=
# Security! Better to use DNS for this task, but you can use redirect
DJANGO_SECURE_SSL_REDIRECT=False DJANGO_SECURE_SSL_REDIRECT=False
# django-allauth
DJANGO_ACCOUNT_ALLOW_REGISTRATION=True DJANGO_ACCOUNT_ALLOW_REGISTRATION=True
{% if cookiecutter.use_sentry == 'y' -%} {% if cookiecutter.use_sentry_for_error_reporting == 'y' -%}
# Sentry
DJANGO_SENTRY_DSN= DJANGO_SENTRY_DSN=
{% endif %} {% endif %}
{% if cookiecutter.use_newrelic == 'y' -%}
NEW_RELIC_LICENSE_KEY=
NEW_RELIC_APP_NAME={{cookiecutter.project_slug}}
{% endif %}
{% if cookiecutter.use_opbeat == 'y' -%} {% if cookiecutter.use_opbeat == 'y' -%}
DJANGO_OPBEAT_ORGANIZATION_ID DJANGO_OPBEAT_ORGANIZATION_ID
DJANGO_OPBEAT_APP_ID DJANGO_OPBEAT_APP_ID
DJANGO_OPBEAT_SECRET_TOKEN DJANGO_OPBEAT_SECRET_TOKEN
{% endif %} {% endif %}
{% if cookiecutter.use_compressor == 'y' -%}
COMPRESS_ENABLED=
{% endif %}

View File

@ -0,0 +1,108 @@
////////////////////////////////
//Setup//
////////////////////////////////
// Plugins
var gulp = require('gulp'),
pjson = require('./package.json'),
gutil = require('gulp-util'),
sass = require('gulp-sass'),
autoprefixer = require('gulp-autoprefixer'),
cssnano = require('gulp-cssnano'),
rename = require('gulp-rename'),
del = require('del'),
plumber = require('gulp-plumber'),
pixrem = require('gulp-pixrem'),
uglify = require('gulp-uglify'),
imagemin = require('gulp-imagemin'),
exec = require('child_process').exec,
runSequence = require('run-sequence'),
browserSync = require('browser-sync').create(),
reload = browserSync.reload;
// Relative paths function
var pathsConfig = function (appName) {
this.app = "./" + (appName || pjson.name);
return {
app: this.app,
templates: this.app + '/templates',
css: this.app + '/static/css',
sass: this.app + '/static/sass',
fonts: this.app + '/static/fonts',
images: this.app + '/static/images',
js: this.app + '/static/js',
}
};
var paths = pathsConfig();
////////////////////////////////
//Tasks//
////////////////////////////////
// Styles autoprefixing and minification
gulp.task('styles', function() {
return gulp.src(paths.sass + '/project.scss')
.pipe(sass().on('error', sass.logError))
.pipe(plumber()) // Checks for errors
.pipe(autoprefixer({browsers: ['last 2 version']})) // Adds vendor prefixes
.pipe(pixrem()) // add fallbacks for rem units
.pipe(gulp.dest(paths.css))
.pipe(rename({ suffix: '.min' }))
.pipe(cssnano()) // Minifies the result
.pipe(gulp.dest(paths.css));
});
// Javascript minification
gulp.task('scripts', function() {
return gulp.src(paths.js + '/project.js')
.pipe(plumber()) // Checks for errors
.pipe(uglify()) // Minifies the js
.pipe(rename({ suffix: '.min' }))
.pipe(gulp.dest(paths.js));
});
// Image compression
gulp.task('imgCompression', function(){
return gulp.src(paths.images + '/*')
.pipe(imagemin()) // Compresses PNG, JPEG, GIF and SVG images
.pipe(gulp.dest(paths.images))
});
// Run django server
gulp.task('runServer', function() {
exec('python manage.py runserver', function (err, stdout, stderr) {
console.log(stdout);
console.log(stderr);
});
});
// Browser sync server for live reload
gulp.task('browserSync', function() {
browserSync.init(
[paths.css + "/*.css", paths.js + "*.js", paths.templates + '*.html'], {
proxy: "localhost:8000"
});
});
// Default task
gulp.task('default', function() {
runSequence(['styles', 'scripts', 'imgCompression'], 'runServer', 'browserSync');
});
////////////////////////////////
//Watch//
////////////////////////////////
// Watch
gulp.task('watch', ['default'], function() {
gulp.watch(paths.sass + '/*.scss', ['styles']);
gulp.watch(paths.js + '/*.js', ['scripts']).on("change", reload);
gulp.watch(paths.images + '/*', ['imgCompression']);
gulp.watch(paths.templates + '/**/*.html').on("change", reload);
});

View File

@ -3,17 +3,33 @@
"version": "{{ cookiecutter.version }}", "version": "{{ cookiecutter.version }}",
"dependencies": {}, "dependencies": {},
"devDependencies": { "devDependencies": {
"grunt": "~0.4.5", {% if cookiecutter.js_task_runner == 'Grunt' %}
"grunt-contrib-watch": "~0.6.1",
"grunt-bg-shell": "~2.3.1",
"connect-livereload": "~0.3.2",
"time-grunt": "~1.2.1",
"load-grunt-tasks": "~3.2.0",
"grunt-sass": "~1.0.0",
"grunt-postcss": "~0.5.5",
"cssnano": "~2.1.0",
"autoprefixer-core": "~5.2.1", "autoprefixer-core": "~5.2.1",
"pixrem": "~1.3.1" "connect-livereload": "~0.3.2",
"cssnano": "~2.1.0",
"grunt": "~0.4.5",
"grunt-bg-shell": "~2.3.1",
"grunt-contrib-watch": "~0.6.1",
"grunt-postcss": "~0.5.5",
"grunt-sass": "~1.0.0",
"load-grunt-tasks": "~3.2.0",
"pixrem": "~1.3.1",
"time-grunt": "~1.2.1"
{% elif cookiecutter.js_task_runner == 'Gulp' %}
"browser-sync": "^2.14.0",
"del": "^2.2.2",
"gulp": "^3.9.1",
"gulp-autoprefixer": "^3.1.1",
"gulp-cssnano": "^2.1.2",
"gulp-imagemin": "^3.0.3",
"gulp-pixrem": "^1.0.0",
"gulp-plumber": "^1.1.0",
"gulp-rename": "^1.2.2",
"gulp-sass": "^2.3.2",
"gulp-uglify": "^2.0.0",
"gulp-util": "^3.0.7",
"run-sequence": "^1.2.2"
{% endif %}
}, },
"engines": { "engines": {
"node": ">=0.8.0" "node": ">=0.8.0"

View File

@ -1,4 +1,4 @@
{% if cookiecutter.use_python2 == 'n' -%} {% if cookiecutter.use_python3 == 'y' -%}
# Wheel 0.25+ needed to install certain packages on CPython 3.5+ # Wheel 0.25+ needed to install certain packages on CPython 3.5+
# like Pillow and psycopg2 # like Pillow and psycopg2
# See http://bitly.com/wheel-building-fails-CPython-35 # See http://bitly.com/wheel-building-fails-CPython-35
@ -7,52 +7,55 @@ wheel==0.29.0
{%- endif %} {%- endif %}
# Bleeding edge Django # Bleeding edge Django
django==1.9.6 django==1.9.9
# Configuration # Configuration
django-environ==0.4.0 django-environ==0.4.0
django-secure==1.0.1
{% if cookiecutter.use_whitenoise == 'y' -%} {% if cookiecutter.use_whitenoise == 'y' -%}
whitenoise==3.0 whitenoise==3.2.1
{%- endif %} {%- endif %}
# Forms # Forms
django-braces==1.8.1 django-braces==1.9.0
django-crispy-forms==1.6.0 django-crispy-forms==1.6.0
django-floppyforms==1.6.2
# Models # Models
django-model-utils==2.5 django-model-utils==2.5.2
# Images # Images
Pillow==3.2.0 Pillow==3.3.1
# For user registration, either via email or social # For user registration, either via email or social
# Well-built with regular release cycles! # Well-built with regular release cycles!
django-allauth==0.25.2 django-allauth==0.27.0
{% if cookiecutter.windows == 'y' -%} {% if cookiecutter.windows == 'y' -%}
# On Windows, you must download/install psycopg2 manually # On Windows, you must download/install psycopg2 manually
# from http://www.lfd.uci.edu/~gohlke/pythonlibs/#psycopg # from http://www.lfd.uci.edu/~gohlke/pythonlibs/#psycopg
{% else %} {% else %}
# Python-PostgreSQL Database Adapter # Python-PostgreSQL Database Adapter
psycopg2==2.6.1 psycopg2==2.6.2
{%- endif %} {%- endif %}
# Unicode slugification # Unicode slugification
unicode-slugify==0.1.3 awesome-slugify==1.6.5
django-autoslug==1.9.3 django-autoslug==1.9.3
# Time zones support # Time zones support
pytz==2016.4 pytz==2016.6.1
# Redis support # Redis support
django-redis==4.4.2 django-redis==4.4.4
redis>=2.10.0 redis>=2.10.0
{% if cookiecutter.use_celery == "y" %} {% if cookiecutter.use_celery == "y" %}
celery==3.1.23 celery==3.1.23
{% endif %} {% endif %}
{% if cookiecutter.use_compressor == "y" %}
rcssmin==1.0.6 {% if cookiecutter.windows == 'y' %}--install-option="--without-c-extensions"{% endif %}
django-compressor==2.1
{% endif %}
# Your custom requirements go here # Your custom requirements go here

View File

@ -1,16 +1,16 @@
# Local development dependencies go here # Local development dependencies go here
-r base.txt -r base.txt
coverage==4.0.3 coverage==4.2
django_coverage_plugin==1.3 django-coverage-plugin==1.3.1
Sphinx Sphinx==1.4.5
django-extensions==1.6.7 django-extensions==1.7.4
Werkzeug==0.11.9 Werkzeug==0.11.11
django-test-plus==1.0.12 django-test-plus==1.0.15
factory_boy==2.7.0 factory_boy==2.7.0
django-debug-toolbar==1.4 django-debug-toolbar==1.5
# improved REPL # improved REPL
ipdb==0.10.0 ipdb==0.10.1
pytest-django==2.9.1 pytest-django==2.9.1
pytest-sugar==0.7.1 pytest-sugar==0.7.1

View File

@ -6,40 +6,34 @@
# Python-PostgreSQL Database Adapter # Python-PostgreSQL Database Adapter
# If using Win for dev, this assumes Unix in prod # If using Win for dev, this assumes Unix in prod
# ------------------------------------------------ # ------------------------------------------------
psycopg2==2.6.1 psycopg2==2.6.2
{%- endif %} {%- endif %}
# WSGI Handler # WSGI Handler
# ------------------------------------------------ # ------------------------------------------------
gevent==1.1.1 gevent==1.1.2
gunicorn==19.5.0 gunicorn==19.6.0
# Static and Media Storage # Static and Media Storage
# ------------------------------------------------ # ------------------------------------------------
boto==2.40.0 boto==2.42.0
django-storages-redux==1.3.2 django-storages-redux==1.3.2
{% if cookiecutter.use_whitenoise != 'y' -%} {% if cookiecutter.use_whitenoise != 'y' -%}
Collectfast==0.2.3 Collectfast==0.2.3
{%- endif %} {%- endif %}
# Mailgun Support # Email backends for Mailgun, Postmark, SendGrid and more
# --------------- # -------------------------------------------------------
django-mailgun==0.9.1 django-anymail==0.4.2
{% if cookiecutter.use_sentry == "y" -%} {% if cookiecutter.use_sentry_for_error_reporting == "y" -%}
# Raven is the Sentry client # Raven is the Sentry client
# -------------------------- # --------------------------
raven raven==5.26.0
{%- endif %}
{% if cookiecutter.use_newrelic == "y" -%}
# Newrelic agent for performance monitoring
# -----------------------------------------
newrelic
{%- endif %} {%- endif %}
{% if cookiecutter.use_opbeat == "y" -%} {% if cookiecutter.use_opbeat == "y" -%}
# Opbeat agent for performance monitoring # Opbeat agent for performance monitoring
# ----------------------------------------- # -----------------------------------------
opbeat opbeat==3.4.0
{%- endif %} {%- endif %}

View File

@ -4,13 +4,12 @@
{% if cookiecutter.windows == 'y' -%} {% if cookiecutter.windows == 'y' -%}
# Python-PostgreSQL Database Adapter # Python-PostgreSQL Database Adapter
# If using Win for dev, this assumes Unix in test/prod # If using Win for dev, this assumes Unix in test/prod
psycopg2==2.6.1 psycopg2==2.6.2
{%- endif %} {%- endif %}
coverage==4.0.3 coverage==4.2
django_coverage_plugin==1.3 flake8==3.0.4 # pyup: != 2.6.0
flake8==2.5.4 django-test-plus==1.0.15
django-test-plus==1.0.12
factory_boy==2.7.0 factory_boy==2.7.0
# pytest # pytest

View File

@ -1,5 +1 @@
{% if cookiecutter.use_python2 == 'n' -%} {% if cookiecutter.use_python3 == 'y' -%}python-3.5.1{% else %}python-2.7.10{%- endif %}
python-3.5.1
{% else %}
python-2.7.10
{%- endif %}

View File

@ -1,61 +1,72 @@
#!/bin/bash #!/bin/bash
WORK_DIR="$(dirname "$0")" WORK_DIR="$(dirname "$0")"
OS_REQUIREMENTS_FILENAME="$WORK_DIR/requirements.apt" DISTRO_NAME=$(lsb_release -sc)
OS_REQUIREMENTS_FILENAME="requirements-$DISTRO_NAME.apt"
VER=$(lsb_release -sr) cd $WORK_DIR
if [ "$VER" == "16.04" ]; then
OS_REQUIREMENTS_FILENAME="requirements.apt.xenial" # Check if a requirements file exist for the current distribution.
else if [ ! -r "$OS_REQUIREMENTS_FILENAME" ]; then
OS_REQUIREMENTS_FILENAME="requirements.apt" cat <<-EOF >&2
There is no requirements file for your distribution.
You can see one of the files listed below to help search the equivalent package in your system:
$(find ./ -name "requirements-*.apt" -printf " - %f\n")
EOF
exit 1;
fi fi
# Handle call with wrong command # Handle call with wrong command
function wrong_command() function wrong_command()
{ {
echo "${0##*/} - unknown command: '${1}'" echo "${0##*/} - unknown command: '${1}'" >&2
usage_message usage_message
} }
# Print help / script usage # Print help / script usage
function usage_message() function usage_message()
{ {
echo "usage: ./${0##*/} <command>" cat <<-EOF
echo "available commands are:" Usage: $WORK_DIR/${0##*/} <command>
echo -e "\tlist\t\tPrint a list of all packages defined on ${OS_REQUIREMENTS_FILENAME} file" Available commands are:
echo -e "\thelp\t\tPrint this help" list Print a list of all packages defined on ${OS_REQUIREMENTS_FILENAME} file
echo -e "\n\tCommands that require superuser permission:" help Print this help
echo -e "\tinstall\t\tInstall packages defined on ${OS_REQUIREMENTS_FILENAME} file. Note: This\n\t\t\t does not upgrade the packages already installed for new\n\t\t\t versions, even if new version is available in the repository."
echo -e "\tupgrade\t\tSame that install, but upgrate the already installed packages,\n\t\t\t if new version is available."
Commands that require superuser permission:
install Install packages defined on ${OS_REQUIREMENTS_FILENAME} file. Note: This
does not upgrade the packages already installed for new versions, even if
new version is available in the repository.
upgrade Same that install, but upgrade the already installed packages, if new
version is available.
EOF
} }
# Read the requirements.apt file, and remove comments and blank lines # Read the requirements.apt file, and remove comments and blank lines
function list_packages(){ function list_packages(){
grep -v "#" ${OS_REQUIREMENTS_FILENAME} | grep -v "^$"; grep -v "#" "${OS_REQUIREMENTS_FILENAME}" | grep -v "^$";
} }
function install() function install_packages()
{ {
list_packages | xargs apt-get --no-upgrade install -y; list_packages | xargs apt-get --no-upgrade install -y;
} }
function upgrade() function upgrade_packages()
{ {
list_packages | xargs apt-get install -y; list_packages | xargs apt-get install -y;
} }
function install_or_upgrade() function install_or_upgrade()
{ {
P=${1} P=${1}
PARAN=${P:-"install"} PARAN=${P:-"install"}
if [[ $EUID -ne 0 ]]; then if [[ $EUID -ne 0 ]]; then
echo -e "\nYou must run this with root privilege" 2>&1 cat <<-EOF >&2
echo -e "Please do:\n" 2>&1 You must run this script with root privilege
echo "sudo ./${0##*/} $PARAN" 2>&1 Please do:
echo -e "\n" 2>&1 sudo $WORK_DIR/${0##*/} $PARAN
EOF
exit 1 exit 1
else else
@ -63,9 +74,9 @@ function install_or_upgrade()
# Install the basic compilation dependencies and other required libraries of this project # Install the basic compilation dependencies and other required libraries of this project
if [ "$PARAN" == "install" ]; then if [ "$PARAN" == "install" ]; then
install; install_packages;
else else
upgrade; upgrade_packages;
fi fi
# cleaning downloaded packages from apt-get cache # cleaning downloaded packages from apt-get cache
@ -73,16 +84,13 @@ function install_or_upgrade()
exit 0 exit 0
fi fi
} }
# Handle command argument # Handle command argument
case "$1" in case "$1" in
install) install_or_upgrade;; install) install_or_upgrade;;
upgrade) install_or_upgrade "upgrade";; upgrade) install_or_upgrade "upgrade";;
list) list_packages;; list) list_packages;;
help) usage_message;; help|"") usage_message;;
*) wrong_command $1;; *) wrong_command "$1";;
esac esac

View File

@ -6,7 +6,7 @@ PROJECT_DIR="$(dirname "$WORK_DIR")"
pip --version >/dev/null 2>&1 || { pip --version >/dev/null 2>&1 || {
echo >&2 -e "\npip is required but it's not installed." echo >&2 -e "\npip is required but it's not installed."
echo >&2 -e "You can install it by running the following command:\n" echo >&2 -e "You can install it by running the following command:\n"
{% if cookiecutter.use_python2 == 'n' -%} {% if cookiecutter.use_python3 == 'y' -%}
echo >&2 "wget https://bootstrap.pypa.io/get-pip.py --output-document=get-pip.py; chmod +x get-pip.py; sudo -H python3 get-pip.py" echo >&2 "wget https://bootstrap.pypa.io/get-pip.py --output-document=get-pip.py; chmod +x get-pip.py; sudo -H python3 get-pip.py"
{% else %} {% else %}
echo >&2 "wget https://bootstrap.pypa.io/get-pip.py --output-document=get-pip.py; chmod +x get-pip.py; sudo -H python2 get-pip.py" echo >&2 "wget https://bootstrap.pypa.io/get-pip.py --output-document=get-pip.py; chmod +x get-pip.py; sudo -H python2 get-pip.py"
@ -19,7 +19,7 @@ pip --version >/dev/null 2>&1 || {
virtualenv --version >/dev/null 2>&1 || { virtualenv --version >/dev/null 2>&1 || {
echo >&2 -e "\nvirtualenv is required but it's not installed." echo >&2 -e "\nvirtualenv is required but it's not installed."
echo >&2 -e "You can install it by running the following command:\n" echo >&2 -e "You can install it by running the following command:\n"
{% if cookiecutter.use_python2 == 'n' -%} {% if cookiecutter.use_python3 == 'y' -%}
echo >&2 "sudo -H pip3 install virtualenv" echo >&2 "sudo -H pip3 install virtualenv"
{% else %} {% else %}
echo >&2 "sudo -H pip2 install virtualenv" echo >&2 "sudo -H pip2 install virtualenv"
@ -32,7 +32,7 @@ virtualenv --version >/dev/null 2>&1 || {
if [ -z "$VIRTUAL_ENV" ]; then if [ -z "$VIRTUAL_ENV" ]; then
echo >&2 -e "\nYou need activate a virtualenv first" echo >&2 -e "\nYou need activate a virtualenv first"
echo >&2 -e 'If you do not have a virtualenv created, run the following command to create and automatically activate a new virtualenv named "venv" on current folder:\n' echo >&2 -e 'If you do not have a virtualenv created, run the following command to create and automatically activate a new virtualenv named "venv" on current folder:\n'
{% if cookiecutter.use_python2 == 'n' -%} {% if cookiecutter.use_python3 == 'y' -%}
echo >&2 -e "virtualenv venv --python=\`which python3\`" echo >&2 -e "virtualenv venv --python=\`which python3\`"
{% else %} {% else %}
echo >&2 -e "virtualenv venv --python=\`which python2\`" echo >&2 -e "virtualenv venv --python=\`which python2\`"

View File

@ -0,0 +1,27 @@
##basic build dependencies of various Django apps for Debian Jessie 8.x
#build-essential metapackage install: make, gcc, g++,
build-essential
#required to translate
gettext
{% if cookiecutter.use_python3 == 'y' -%}
python3-dev
{% else %}
python-dev
{%- endif %}
##shared dependencies of:
##Pillow, pylibmc
zlib1g-dev
##Postgresql and psycopg2 dependencies
libpq-dev
##Pillow dependencies
libtiff5-dev
libjpeg62-turbo-dev
libfreetype6-dev
liblcms2-dev
libwebp-dev
##django-extensions
graphviz-dev

View File

@ -1,9 +1,9 @@
##basic build dependencies of various Django apps for Ubuntu 14.04 ##basic build dependencies of various Django apps for Ubuntu Trusty 14.04
#build-essential metapackage install: make, gcc, g++, #build-essential metapackage install: make, gcc, g++,
build-essential build-essential
#required to translate #required to translate
gettext gettext
{% if cookiecutter.use_python2 == 'n' -%} {% if cookiecutter.use_python3 == 'y' -%}
python3-dev python3-dev
{% else %} {% else %}
python-dev python-dev
@ -25,3 +25,4 @@ libwebp-dev
##django-extensions ##django-extensions
graphviz-dev graphviz-dev

View File

@ -0,0 +1,28 @@
##basic build dependencies of various Django apps for Ubuntu Xenial 16.04
#build-essential metapackage install: make, gcc, g++,
build-essential
#required to translate
gettext
{% if cookiecutter.use_python3 == 'y' -%}
python3-dev
{% else %}
python-dev
{%- endif %}
##shared dependencies of:
##Pillow, pylibmc
zlib1g-dev
##Postgresql and psycopg2 dependencies
libpq-dev
##Pillow dependencies
libtiff5-dev
libjpeg8-dev
libfreetype6-dev
liblcms2-dev
libwebp-dev
##django-extensions
graphviz-dev

View File

@ -1,44 +0,0 @@
##basic build dependencies of various Django apps for Ubuntu 14.04
#build-essential metapackage install: make, gcc, g++,
build-essential
#required to translate
gettext
python-dev
##shared dependencies of:
##Pillow, pylibmc
zlib1g-dev
##Postgresql and psycopg2 dependencies
libpq-dev
##Pillow dependencies
libtiff5-dev
libjpeg8-dev
libfreetype6-dev
liblcms2-dev
libwebp-dev
##django-extensions
graphviz-dev
##hitch
python-setuptools
python3-dev
python-virtualenv
python-pip
firefox
automake
libtool
libreadline6
libreadline6-dev
libreadline-dev
libsqlite3-dev
libxml2
libxml2-dev
libssl-dev
libbz2-dev
wget
curl
llvm

View File

@ -1 +1,21 @@
/* Project specific Javascript goes here. */ /* Project specific Javascript goes here. */
/*
Formatting hack to get around crispy-forms unfortunate hardcoding
in helpers.FormHelper:
if template_pack == 'bootstrap4':
grid_colum_matcher = re.compile('\w*col-(xs|sm|md|lg|xl)-\d+\w*')
using_grid_layout = (grid_colum_matcher.match(self.label_class) or
grid_colum_matcher.match(self.field_class))
if using_grid_layout:
items['using_grid_layout'] = True
Issues with the above approach:
1. Fragile: Assumes Bootstrap 4's API doesn't change (it does)
2. Unforgiving: Doesn't allow for any variation in template design
3. Really Unforgiving: No way to override this behavior
4. Undocumented: No mention in the documentation, or it's too hard for me to find
*/
$('.form-group').removeClass('row');

View File

@ -1,5 +1,10 @@
// project specific CSS goes here // project specific CSS goes here
////////////////////////////////
//Variables//
////////////////////////////////
// Alert colors // Alert colors
$white: #fff; $white: #fff;
@ -9,6 +14,10 @@ $pink: #f2dede;
$dark-pink: #eed3d7; $dark-pink: #eed3d7;
$red: #b94a48; $red: #b94a48;
////////////////////////////////
//Alerts//
////////////////////////////////
// bootstrap alert CSS, translated to the django-standard levels of // bootstrap alert CSS, translated to the django-standard levels of
// debug, info, success, warning, error // debug, info, success, warning, error
@ -24,8 +33,16 @@ $red: #b94a48;
color: $red; color: $red;
} }
////////////////////////////////
//Navbar//
////////////////////////////////
// This is a fix for the bootstrap4 alpha release // This is a fix for the bootstrap4 alpha release
.navbar {
border-radius: 0px;
}
@media (max-width: 47.9em) { @media (max-width: 47.9em) {
.navbar-nav .nav-item { .navbar-nav .nav-item {
display: inline-block; display: inline-block;
@ -42,6 +59,10 @@ $red: #b94a48;
} }
} }
////////////////////////////////
//Django Toolbar//
////////////////////////////////
// Display django-debug-toolbar. // Display django-debug-toolbar.
// See https://github.com/django-debug-toolbar/django-debug-toolbar/issues/742 // See https://github.com/django-debug-toolbar/django-debug-toolbar/issues/742
// and https://github.com/pydanny/cookiecutter-django/issues/317 // and https://github.com/pydanny/cookiecutter-django/issues/317

View File

@ -2,7 +2,7 @@
from __future__ import absolute_import from __future__ import absolute_import
import os import os
from celery import Celery from celery import Celery
from django.apps import AppConfig from django.apps import apps, AppConfig
from django.conf import settings from django.conf import settings
@ -22,9 +22,10 @@ class CeleryConfig(AppConfig):
# Using a string here means the worker will not have to # Using a string here means the worker will not have to
# pickle the object when using Windows. # pickle the object when using Windows.
app.config_from_object('django.conf:settings') app.config_from_object('django.conf:settings')
app.autodiscover_tasks(lambda: settings.INSTALLED_APPS, force=True) installed_apps = [app_config.name for app_config in apps.get_app_configs()]
app.autodiscover_tasks(lambda: installed_apps, force=True)
{% if cookiecutter.use_sentry == 'y' -%} {% if cookiecutter.use_sentry_for_error_reporting == 'y' -%}
if hasattr(settings, 'RAVEN_CONFIG'): if hasattr(settings, 'RAVEN_CONFIG'):
# Celery signal registration # Celery signal registration
from raven import Client as RavenClient from raven import Client as RavenClient

View File

@ -0,0 +1,12 @@
{% raw %}{% extends "account/base.html" %}
{% load i18n %}
{% block head_title %}{% trans "Account Inactive" %}{% endblock %}
{% block inner %}
<h1>{% trans "Account Inactive" %}</h1>
<p>{% trans "This account is inactive." %}</p>
{% endblock %}
{% endraw %}

View File

@ -1,3 +1,11 @@
{% raw %}{% extends "base.html" %} {% raw %}{% extends "base.html" %}
{% block title %}{% block head_title %}{% endblock head_title %}{% endblock title %} {% block title %}{% block head_title %}{% endblock head_title %}{% endblock title %}
{% block content %}
<div class="row">
<div class="col-md-6 offset-md-3">
{% block inner %}{% endblock %}
</div>
</div>
{% endblock %}
{% endraw %} {% endraw %}

View File

@ -1,68 +1,66 @@
{% raw %}{% extends "account/base.html" %} {% raw %}
{% extends "account/base.html" %}
{% load i18n %} {% load i18n %}
{% load crispy_forms_tags %} {% load crispy_forms_tags %}
{% block head_title %}{% trans "Account" %}{% endblock %} {% block head_title %}{% trans "Account" %}{% endblock %}
{% block content %} {% block inner %}
<div class="container"> <h1>{% trans "E-mail Addresses" %}</h1>
<div class="row">
<div class="col-md-5">
<h2>{% trans "E-mail Addresses" %}</h2>
{% if user.emailaddress_set.all %}
<p>{% trans 'The following e-mail addresses are associated with your account:' %}</p>
<form action="{% url 'account_email' %}" class="email_list" method="post"> {% if user.emailaddress_set.all %}
{% csrf_token %} <p>{% trans 'The following e-mail addresses are associated with your account:' %}</p>
<fieldset class="blockLabels">
{% for emailaddress in user.emailaddress_set.all %} <form action="{% url 'account_email' %}" class="email_list" method="post">
<div class="ctrlHolder"> {% csrf_token %}
<label for="email_radio_{{ forloop.counter }}" class="{% if emailaddress.primary %}primary_email{% endif %}"> <fieldset class="blockLabels">
<input id="email_radio_{{ forloop.counter }}" type="radio" name="email" {% if emailaddress.primary %}checked="checked"{% endif %} value="{{ emailaddress.email }}"/> {% for emailaddress in user.emailaddress_set.all %}
<div class="radio">
<label for="email_radio_{{forloop.counter}}" class="{% if emailaddress.primary %}primary_email{%endif%}">
{{ emailaddress.email }} <input id="email_radio_{{forloop.counter}}" type="radio" name="email" {% if emailaddress.primary or user.emailaddress_set.count == 1 %}checked="checked"{%endif %} value="{{emailaddress.email}}"/>
{% if emailaddress.verified %}
<span class="verified">{% trans "Verified" %}</span>
{% else %}
<span class="unverified">{% trans "Unverified" %}</span>
{% endif %}
{% if emailaddress.primary %}<span class="primary">{% trans "Primary" %}</span>{% endif %}
</label>
</div>
{% endfor %}
<div class="buttonHolder"> {{ emailaddress.email }}
<button class="secondaryAction" type="submit" name="action_primary" >{% trans 'Make Primary' %}</button> {% if emailaddress.verified %}
<button class="secondaryAction" type="submit" name="action_send" >{% trans 'Re-send Verification' %}</button> <span class="verified">{% trans "Verified" %}</span>
<button class="primaryAction" type="submit" name="action_remove" >{% trans 'Remove' %}</button> {% else %}
</div> <span class="unverified">{% trans "Unverified" %}</span>
{% endif %}
</fieldset> {% if emailaddress.primary %}<span class="primary">{% trans "Primary" %}</span>{% endif %}
</form> </label>
{% else %}
<p><strong>{% trans 'Warning:'%}</strong> {% trans "You currently do not have any e-mail address set up. You should really add an e-mail address so you can receive notifications, reset your password, etc." %}</p>
{% endif %}
<h2>{% trans "Add E-mail Address" %}</h2>
<form method="post" action="." class="add_email">
{% csrf_token %}
{{ form|crispy }}
<button class="btn" name="action_add" type="submit">{% trans "Add E-mail" %}</button>
</form>
</div>
</div>
</div> </div>
{% endfor %}
<div class="form-group">
<button class="secondaryAction btn btn-primary" type="submit" name="action_primary" >{% trans 'Make Primary' %}</button>
<button class="secondaryAction btn btn-primary" type="submit" name="action_send" >{% trans 'Re-send Verification' %}</button>
<button class="primaryAction btn btn-primary" type="submit" name="action_remove" >{% trans 'Remove' %}</button>
</div>
</fieldset>
</form>
{% else %}
<p><strong>{% trans 'Warning:'%}</strong> {% trans "You currently do not have any e-mail address set up. You should really add an e-mail address so you can receive notifications, reset your password, etc." %}</p>
{% endif %}
<h2>{% trans "Add E-mail Address" %}</h2>
<form method="post" action="{% url 'account_email' %}" class="add_email">
{% csrf_token %}
{{ form|crispy }}
<button class="btn btn-primary" name="action_add" type="submit">{% trans "Add E-mail" %}</button>
</form>
{% endblock %} {% endblock %}
{% block extra_body %} {% block javascript %}
{{ block.super }}
<script type="text/javascript"> <script type="text/javascript">
(function() { (function() {
var message = "{% trans 'Do you really want to remove the selected e-mail address?' %}"; var message = "{% trans 'Do you really want to remove the selected e-mail address?' %}";
@ -75,6 +73,8 @@
}); });
} }
})(); })();
$('.form-group').removeClass('row');
</script> </script>
{% endblock %} {% endblock %}
{% endraw %} {% endraw %}

View File

@ -6,32 +6,27 @@
{% block head_title %}{% trans "Confirm E-mail Address" %}{% endblock %} {% block head_title %}{% trans "Confirm E-mail Address" %}{% endblock %}
{% block content %} {% block inner %}
<div class="container"> <h1>{% trans "Confirm E-mail Address" %}</h1>
<div class="row">
<div class="col-xs-12">
<h2>{% trans "Confirm E-mail Address" %}</h2>
{% if confirmation %} {% if confirmation %}
{% user_display confirmation.email_address.user as user_display %} {% user_display confirmation.email_address.user as user_display %}
<p>{% blocktrans with confirmation.email_address.email as email %}Please confirm that <a href="mailto:{{ email }}">{{ email }}</a> is an e-mail address for user {{ user_display }}.{% endblocktrans %}</p> <p>{% blocktrans with confirmation.email_address.email as email %}Please confirm that <a href="mailto:{{ email }}">{{ email }}</a> is an e-mail address for user {{ user_display }}.{% endblocktrans %}</p>
<form method="post" action="{% url 'account_confirm_email' confirmation.key %}"> <form method="post" action="{% url 'account_confirm_email' confirmation.key %}">
{% csrf_token %} {% csrf_token %}
<button id="confirm-button" class="submit" type="submit">{% trans 'Confirm' %}</button> <button class="btn btn-primary" type="submit">{% trans 'Confirm' %}</button>
</form> </form>
{% else %} {% else %}
{% url 'account_email' as email_url %} {% url 'account_email' as email_url %}
<p>{% blocktrans %}This e-mail confirmation link expired or is invalid. Please <a href="{{ email_url }}">issue a new e-mail confirmation request</a>.{% endblocktrans %}</p> <p>{% blocktrans %}This e-mail confirmation link expired or is invalid. Please <a href="{{ email_url }}">issue a new e-mail confirmation request</a>.{% endblocktrans %}</p>
{% endif %}
{% endif %}
</div>
</div>
</div>
{% endblock %} {% endblock %}
{% endraw %} {% endraw %}

View File

@ -1,22 +0,0 @@
{% raw %}{% extends "account/base.html" %}
{% load i18n %}
{% load account %}
{% block head_title %}{% trans "Confirm E-mail Address" %}{% endblock %}
{% block content %}
<div class="container">
<div class="row">
<div class="col-xs-12">
<h2>{% trans "Confirm E-mail Address" %}</h2>
{% user_display email_address.user as user_display %}
<p>{% blocktrans with email_address.email as email %}You have confirmed that <a href="mailto:{{ email }}">{{ email }}</a> is an e-mail address for user {{ user_display }}.{% endblocktrans %}</p>
</div>
</div>
</div>
{% endblock %}
{% endraw %}

View File

@ -1,48 +1,48 @@
{% raw %}{% extends "account/base.html" %} {% raw %}{% extends "account/base.html" %}
{% load i18n %} {% load i18n %}
{% load account %} {% load account socialaccount %}
{% load socialaccount %}
{% load crispy_forms_tags %} {% load crispy_forms_tags %}
{% block head_title %}{% trans "Sign In" %}{% endblock %} {% block head_title %}{% trans "Sign In" %}{% endblock %}
{% block content %} {% block inner %}
<div class="container">
<div class="row">
<div class="col-md-5">
<h2>{% trans "Sign In" %}</h2>
{% get_providers as socialaccount_providers %}
{% if socialaccount_providers %}
<p>{% blocktrans with site.name as site_name %}Please sign in with one
of your existing third party accounts. Or, <a href="{{ signup_url }}">sign up</a>
for a {{ site_name }} account and sign in below:{% endblocktrans %}</p>
<div class="socialaccount_ballot"> <h1>{% trans "Sign In" %}</h1>
<ul class="socialaccount_providers"> {% get_providers as socialaccount_providers %}
{% include "socialaccount/snippets/provider_list.html" with process="login" %}
</ul>
<div class="login-or">{% trans 'or' %}</div> {% if socialaccount_providers %}
<p>{% blocktrans with site.name as site_name %}Please sign in with one
of your existing third party accounts. Or, <a href="{{ signup_url }}">sign up</a>
for a {{ site_name }} account and sign in below:{% endblocktrans %}</p>
</div> <div class="socialaccount_ballot">
{% include "socialaccount/snippets/login_extra.html" %} <ul class="socialaccount_providers">
{% include "socialaccount/snippets/provider_list.html" with process="login" %}
</ul>
{% endif %} <div class="login-or">{% trans 'or' %}</div>
<form class="login" method="POST" action="{% url 'account_login' %}">
{% csrf_token %}
{{ form|crispy }}
{% if redirect_field_value %}
<input type="hidden" name="{{ redirect_field_name }}" value="{{ redirect_field_value }}" />
{% endif %}
<button id="sign-in-button" class="btn btn-primary" type="submit">{% trans "Sign In" %}</button>
<a class="button secondaryAction" href="{% url 'account_reset_password' %}">{% trans "Forgot Password?" %}</a>
</form>
</div>
</div>
</div> </div>
{% include "socialaccount/snippets/login_extra.html" %}
{% else %}
<p>{% blocktrans %}If you have not created an account yet, then please
<a href="{{ signup_url }}">sign up</a> first.{% endblocktrans %}</p>
{% endif %}
<form class="login" method="POST" action="{% url 'account_login' %}">
{% csrf_token %}
{{ form|crispy }}
{% if redirect_field_value %}
<input type="hidden" name="{{ redirect_field_name }}" value="{{ redirect_field_value }}" />
{% endif %}
<a class="button secondaryAction" href="{% url 'account_reset_password' %}">{% trans "Forgot Password?" %}</a>
<button class="primaryAction btn btn-primary" type="submit">{% trans "Sign In" %}</button>
</form>
{% endblock %} {% endblock %}
{% endraw %} {% endraw %}

View File

@ -4,25 +4,19 @@
{% block head_title %}{% trans "Sign Out" %}{% endblock %} {% block head_title %}{% trans "Sign Out" %}{% endblock %}
{% block content %} {% block inner %}
<div class="container"> <h1>{% trans "Sign Out" %}</h1>
<div class="row">
<div class="col-md-5">
<h2>{% trans "Sign Out" %}</h2> <p>{% trans 'Are you sure you want to sign out?' %}</p>
<p>{% trans 'Are you sure you want to sign out?' %}</p> <form method="post" action="{% url 'account_logout' %}">
{% csrf_token %}
{% if redirect_field_value %}
<input type="hidden" name="{{ redirect_field_name }}" value="{{ redirect_field_value }}"/>
{% endif %}
<button class="btn btn-danger" type="submit">{% trans 'Sign Out' %}</button>
</form>
<form method="post" action="{% url 'account_logout' %}">
{% csrf_token %}
{% if redirect_field_value %}
<input type="hidden" name="{{ redirect_field_name }}" value="{{ redirect_field_value }}"/>
{% endif %}
<button class="btn btn-danger" type="submit">{% trans 'Sign Out' %}</button>
</form>
</div>
</div>
</div>
{% endblock %} {% endblock %}
{% endraw %} {% endraw %}

View File

@ -2,21 +2,16 @@
{% load i18n %} {% load i18n %}
{% load crispy_forms_tags %} {% load crispy_forms_tags %}
{% block head_title %}{% trans "Change Password" %}{% endblock %} {% block head_title %}{% trans "Change Password" %}{% endblock %}
{% block content %} {% block inner %}
<div class="container"> <h1>{% trans "Change Password" %}</h1>
<div class="row">
<div class="col-md-5">
<h2>{% trans "Change Password" %}</h2>
<form method="POST" action="./" class="password_change"> <form method="POST" action="{% url 'account_change_password' %}" class="password_change">
{% csrf_token %} {% csrf_token %}
{{ form|crispy }} {{ form|crispy }}
<button class="btn" type="submit" name="action">{% trans "Change Password" %}</button> <button class="btn btn-primary" type="submit" name="action">{% trans "Change Password" %}</button>
</form> </form>
</div>
</div>
</div>
{% endblock %} {% endblock %}
{% endraw %} {% endraw %}

View File

@ -6,34 +6,21 @@
{% block head_title %}{% trans "Password Reset" %}{% endblock %} {% block head_title %}{% trans "Password Reset" %}{% endblock %}
{% block content %} {% block inner %}
<div class="container">
<div class="row">
<div class="col-md-5">
<h2>{% trans "Password Reset" %}</h2> <h1>{% trans "Password Reset" %}</h1>
{% if user.is_authenticated %} {% if user.is_authenticated %}
{% include "account/snippets/already_logged_in.html" %} {% include "account/snippets/already_logged_in.html" %}
{% endif %} {% endif %}
<p>{% trans "Forgotten your password? Enter your e-mail address below, and we'll send you an e-mail allowing you to reset it." %}</p> <p>{% trans "Forgotten your password? Enter your e-mail address below, and we'll send you an e-mail allowing you to reset it." %}</p>
<form method="POST" action="./" class="password_reset"> <form method="POST" action="{% url 'account_reset_password' %}" class="password_reset">
{% csrf_token %} {% csrf_token %}
{{ form|crispy }} {{ form|crispy }}
<button class="btn" type="submit">{% trans "Reset My Password" %}</button> <input type="submit" value="{% trans 'Reset My Password' %}" />
</form> </form>
<p>{% blocktrans %}Please contact us if you have any trouble resetting your password.{% endblocktrans %}</p> <p>{% blocktrans %}Please contact us if you have any trouble resetting your password.{% endblocktrans %}</p>
</div>
</div>
</div>
{% endblock %} {% endblock %}
{% block javascript %}
{{ block.super }}
<script>
$("#id_email").focus();
</script>
{% endblock javascript %}
{% endraw %} {% endraw %}

View File

@ -5,19 +5,13 @@
{% block head_title %}{% trans "Password Reset" %}{% endblock %} {% block head_title %}{% trans "Password Reset" %}{% endblock %}
{% block content %} {% block inner %}
<div class="container"> <h1>{% trans "Password Reset" %}</h1>
<div class="row">
<div class="col-xs-12"> {% if user.is_authenticated %}
<h2>{% trans "Password Reset" %}</h2> {% include "account/snippets/already_logged_in.html" %}
{% endif %}
{% if user.is_authenticated %}
{% include "account/snippets/already_logged_in.html" %} <p>{% blocktrans %}We have sent you an e-mail. Please contact us if you do not receive it within a few minutes.{% endblocktrans %}</p>
{% endif %}
<p>{% blocktrans %}We have sent you an e-mail. Please contact us if you do not receive it within a few minutes.{% endblocktrans %}</p>
</div>
</div>
</div>
{% endblock %} {% endblock %}
{% endraw %} {% endraw %}

View File

@ -2,31 +2,24 @@
{% load i18n %} {% load i18n %}
{% load crispy_forms_tags %} {% load crispy_forms_tags %}
{% block head_title %}{% trans "Change Password" %}{% endblock %} {% block head_title %}{% trans "Change Password" %}{% endblock %}
{% block content %} {% block inner %}
<div class="container"> <h1>{% if token_fail %}{% trans "Bad Token" %}{% else %}{% trans "Change Password" %}{% endif %}</h1>
<div class="row">
<div class="col-xs-12">
<h2>{% if token_fail %}{% trans "Bad Token" %}{% else %}{% trans "Change Password" %}{% endif %}</h2>
{% if token_fail %} {% if token_fail %}
{% url 'account_reset_password' as passwd_reset_url %} {% url 'account_reset_password' as passwd_reset_url %}
<p>{% blocktrans %}The password reset link was invalid, possibly because it has already been used. Please request a <a href="{{ passwd_reset_url }}">new password reset</a>.{% endblocktrans %}</p> <p>{% blocktrans %}The password reset link was invalid, possibly because it has already been used. Please request a <a href="{{ passwd_reset_url }}">new password reset</a>.{% endblocktrans %}</p>
{% else %} {% else %}
{% if form %} {% if form %}
<form method="POST" action="./"> <form method="POST" action=".">
{% csrf_token %} {% csrf_token %}
{{ form|crispy }} {{ form|crispy }}
<button type="submit" name="action">{% trans "change password" %}</button> <input type="submit" name="action" value="{% trans 'change password' %}"/>
</form> </form>
{% else %} {% else %}
<p>{% trans 'Your password is now changed.' %}</p> <p>{% trans 'Your password is now changed.' %}</p>
{% endif %} {% endif %}
{% endif %} {% endif %}
</div>
</div>
</div>
{% endblock %} {% endblock %}
{% endraw %} {% endraw %}

View File

@ -3,14 +3,8 @@
{% load i18n %} {% load i18n %}
{% block head_title %}{% trans "Change Password" %}{% endblock %} {% block head_title %}{% trans "Change Password" %}{% endblock %}
{% block content %} {% block inner %}
<div class="container"> <h1>{% trans "Change Password" %}</h1>
<div class="row"> <p>{% trans 'Your password is now changed.' %}</p>
<div class="col-md-5">
<h2>{% trans "Change Password" %}</h2>
<p>{% trans 'Your password is now changed.' %}</p>
</div>
</div>
</div>
{% endblock %} {% endblock %}
{% endraw %} {% endraw %}

View File

@ -1,23 +1,17 @@
{% raw %} {% raw %}{% extends "account/base.html" %}
{% extends "account/base.html" %}
{% load i18n crispy_forms_tags %} {% load i18n %}
{% load crispy_forms_tags %}
{% block head_title %}{% trans "Set Password" %}{% endblock %} {% block head_title %}{% trans "Set Password" %}{% endblock %}
{% block content %} {% block inner %}
<div class="container"> <h1>{% trans "Set Password" %}</h1>
<div class="row">
<div class="col-md-5">
<h2>{% trans "Set Password" %}</h2>
<form method="POST" action="./" class="password_set"> <form method="POST" action="{% url 'account_set_password' %}" class="password_set">
{% csrf_token %} {% csrf_token %}
{{ form|crispy }} {{ form|crispy }}
<input type="submit" name="action" value="{% trans "Set Password" %}"/> <input type="submit" name="action" value="{% trans 'Set Password' %}"/>
</form> </form>
</div>
</div>
</div>
{% endblock %} {% endblock %}
{% endraw %} {% endraw %}

View File

@ -3,31 +3,21 @@
{% load i18n %} {% load i18n %}
{% load crispy_forms_tags %} {% load crispy_forms_tags %}
{% block title %}{% trans "Signup" %}{% endblock title %} {% block head_title %}{% trans "Signup" %}{% endblock %}
{% block content %} {% block inner %}
<h1>{% trans "Sign Up" %}</h1>
<div class="container"> <p>{% blocktrans %}Already have an account? Then please <a href="{{ login_url }}">sign in</a>.{% endblocktrans %}</p>
<div class="row">
<div class="col-md-5">
<h1>{% trans "Sign Up" %}</h1>
<p>{% blocktrans %}Already have an account? Then please <a href="{{ login_url }}">sign in</a>.{% endblocktrans %}</p>
<form class="signup" id="signup_form" method="post" action="{% url 'account_signup' %}">
{% csrf_token %}
{{ form|crispy }}
{% if redirect_field_value %}
<input type="hidden" name="{{ redirect_field_name }}" value="{{ redirect_field_value }}" />
{% endif %}
<button id="sign-up-button" class="btn btn-primary" type="submit">{% trans "Sign Up" %} &raquo;</button>
</form>
</div>
</div>
</div>
{% endblock content %}
<form class="signup" id="signup_form" method="post" action="{% url 'account_signup' %}">
{% csrf_token %}
{{ form|crispy }}
{% if redirect_field_value %}
<input type="hidden" name="{{ redirect_field_name }}" value="{{ redirect_field_value }}" />
{% endif %}
<button class="btn btn-primary" type="submit">{% trans "Sign Up" %} &raquo;</button>
</form>
{% endblock %}
{% endraw %} {% endraw %}

View File

@ -4,15 +4,9 @@
{% block head_title %}{% trans "Sign Up Closed" %}{% endblock %} {% block head_title %}{% trans "Sign Up Closed" %}{% endblock %}
{% block content %} {% block inner %}
<div class="container"> <h1>{% trans "Sign Up Closed" %}</h1>
<div class="row">
<div class="col-md-5">
<h2>{% trans "Sign Up Closed" %}</h2>
<p>{% trans "We are sorry, but the sign up is currently closed." %}</p> <p>{% trans "We are sorry, but the sign up is currently closed." %}</p>
</div>
</div>
</div>
{% endblock %} {% endblock %}
{% endraw %} {% endraw %}

View File

@ -4,16 +4,10 @@
{% block head_title %}{% trans "Verify Your E-mail Address" %}{% endblock %} {% block head_title %}{% trans "Verify Your E-mail Address" %}{% endblock %}
{% block content %} {% block inner %}
<div class="container"> <h1>{% trans "Verify Your E-mail Address" %}</h1>
<div class="row">
<div class="col-md-5"> <p>{% blocktrans %}We have sent an e-mail to you for verification. Follow the link provided to finalize the signup process. Please contact us if you do not receive it within a few minutes.{% endblocktrans %}</p>
<h2>{% trans "Verify Your E-mail Address" %}</h2>
<p>{% blocktrans %}We have sent an e-mail to <a href="mailto:{{ email }}">{{ email }}</a> for verification. Follow the link provided to finalize the signup process. Please contact us if you do not receive it within a few minutes.{% endblocktrans %}</p>
</div>
</div>
</div>
{% endblock %} {% endblock %}
{% endraw %} {% endraw %}

View File

@ -4,25 +4,21 @@
{% block head_title %}{% trans "Verify Your E-mail Address" %}{% endblock %} {% block head_title %}{% trans "Verify Your E-mail Address" %}{% endblock %}
{% block content %} {% block inner %}
<div class="container"> <h1>{% trans "Verify Your E-mail Address" %}</h1>
<div class="row">
<div class="col-md-5">
<h2>{% trans "Verify Your E-mail Address" %}</h2>
{% url 'account_email' as email_url %} {% url 'account_email' as email_url %}
<p>{% blocktrans %}This part of the site requires us to verify that <p>{% blocktrans %}This part of the site requires us to verify that
you are who you claim to be. For this purpose, we require that you you are who you claim to be. For this purpose, we require that you
verify ownership of your e-mail address. {% endblocktrans %}</p> verify ownership of your e-mail address. {% endblocktrans %}</p>
<p>{% blocktrans %}We have sent an e-mail to you for
verification. Please click on the link inside this e-mail. Please
contact us if you do not receive it within a few minutes.{% endblocktrans %}</p>
<p>{% blocktrans %}<strong>Note:</strong> you can still <a href="{{ email_url }}">change your e-mail address</a>.{% endblocktrans %}</p>
<p>{% blocktrans %}We have sent an e-mail to you for
verification. Please click on the link inside this e-mail. Please
contact us if you do not receive it within a few minutes.{% endblocktrans %}</p>
<p>{% blocktrans %}<strong>Note:</strong> you can still <a href="{{ email_url }}">change your e-mail address</a>.{% endblocktrans %}</p>
</div>
</div>
</div>
{% endblock %} {% endblock %}
{% endraw %} {% endraw %}

View File

@ -1,5 +1,5 @@
{% raw %}{% load staticfiles i18n %}<!DOCTYPE html> {% raw %}{% load staticfiles i18n {% endraw %}{% if cookiecutter.use_compressor == "y" %}compress{% endif %}{% raw %}%}<!DOCTYPE html>
<html lang="en" {% endraw %}{% if cookiecutter.use_angular == "y" %}ng-app{% endif %}{% raw %}> <html lang="en">
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8">
<meta http-equiv="x-ua-compatible" content="ie=edge"> <meta http-equiv="x-ua-compatible" content="ie=edge">
@ -14,24 +14,21 @@
<![endif]--> <![endif]-->
{% block css %} {% block css %}
<!-- Latest compiled and minified CSS --> <!-- Latest compiled and minified Bootstrap 4 Alpha 3 CSS -->
<link rel="stylesheet" href="https://cdn.rawgit.com/twbs/bootstrap/v4-dev/dist/css/bootstrap.css"> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.3/css/bootstrap.min.css" integrity="sha384-MIwDKRSSImVFAZCVLtU0LMDdON6KVCrZHyVQQj6e8wIEJkW4tvwqXrbMIya1vriY" crossorigin="anonymous">
<!-- Your stuff: Third-party css libraries go here --> <!-- Your stuff: Third-party CSS libraries go here -->
{% endraw %}{% if cookiecutter.use_compressor == "y" %}{% raw %}{% compress css %}{% endraw %}{% endif %}{% raw %}
<!-- This file store project specific CSS --> <!-- This file stores project-specific CSS -->
<link href="{% static 'css/project.css' %}" rel="stylesheet"> <link href="{% static 'css/project.css' %}" rel="stylesheet">
{% endraw %}{% if cookiecutter.use_compressor == "y" %}{% raw %}{% endcompress %}{% endraw %}{% endif %}{% raw %}
{% endblock %} {% endblock %}
{% endraw %}{% if cookiecutter.use_angular == "y" %}{% raw %}{% block angular %}
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.5.5/angular.min.js"></script>
{% endblock %}{% endraw %}{% endif %}{% raw %}
</head> </head>
<body> <body>
<div class="m-b"> <div class="m-b-1">
<nav class="navbar navbar-dark navbar-static-top bg-inverse"> <nav class="navbar navbar-dark navbar-static-top bg-inverse">
<div class="container"> <div class="container">
<a class="navbar-brand" href="/">{% endraw %}{{ cookiecutter.project_name }}{% raw %}</a> <a class="navbar-brand" href="/">{% endraw %}{{ cookiecutter.project_name }}{% raw %}</a>
@ -56,14 +53,14 @@
<a class="nav-link" href="{% url 'users:detail' request.user.username %}">{% trans "My Profile" %}</a> <a class="nav-link" href="{% url 'users:detail' request.user.username %}">{% trans "My Profile" %}</a>
</li> </li>
<li class="nav-item"> <li class="nav-item">
<a class="nav-link" href="{% url 'account_logout' %}">{% trans "Logout" %}</a> <a class="nav-link" href="{% url 'account_logout' %}">{% trans "Sign out" %}</a>
</li> </li>
{% else %} {% else %}
<li class="nav-item"> <li class="nav-item">
<a id="sign-up-link" class="nav-link" href="{% url 'account_signup' %}">{% trans "Sign Up" %}</a> <a id="sign-up-link" class="nav-link" href="{% url 'account_signup' %}">{% trans "Sign Up" %}</a>
</li> </li>
<li class="nav-item"> <li class="nav-item">
<a id="log-in-link" class="nav-link" href="{% url 'account_login' %}">{% trans "Log In" %}</a> <a id="log-in-link" class="nav-link" href="{% url 'account_login' %}">{% trans "Sign In" %}</a>
</li> </li>
{% endif %} {% endif %}
</ul> </ul>
@ -92,19 +89,18 @@
================================================== --> ================================================== -->
<!-- Placed at the end of the document so the pages load faster --> <!-- Placed at the end of the document so the pages load faster -->
{% block javascript %} {% block javascript %}
<!-- Latest JQuery --> <!-- Required by Bootstrap v4 Alpha 3 -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.0/jquery.min.js"></script> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.0.0/jquery.min.js" integrity="sha384-THPy051/pYDQGanwU6poAc/hOdQxjnOEXzbT+OuUAFqNqFjL+4IGLBgCJC3ZOShY" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/tether/1.2.0/js/tether.min.js" integrity="sha384-Plbmg8JY28KFelvJVai01l8WyZzrYWG825m+cZ0eDDS1f7d/js6ikvy1+X+guPIB" crossorigin="anonymous"></script>
<!-- Tether - a requirement for Bootstrap tooltips --> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.3/js/bootstrap.min.js" integrity="sha384-ux8v3A6CPtOTqOzMKiuo3d/DomGaaClxFYdCu2HPMBEkf6x2xiDyJ7gkXU0MWwaD" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/tether/1.2.0/js/tether.min.js"></script>
<!-- Latest compiled and minified JavaScript -->
<script src="https://cdn.rawgit.com/twbs/bootstrap/v4-dev/dist/js/bootstrap.js"></script>
<!-- Your stuff: Third-party javascript libraries go here --> <!-- Your stuff: Third-party javascript libraries go here -->
<!-- place project specific Javascript in this file --> <!-- place project specific Javascript in this file -->
{% endraw %}{% if cookiecutter.use_compressor == "y" %}{% raw %}{% compress js %}{% endraw %}{% endif %}{% raw %}
<script src="{% static 'js/project.js' %}"></script> <script src="{% static 'js/project.js' %}"></script>
{% endraw %}{% if cookiecutter.use_compressor == "y" %}{% raw %}{% endcompress %}{% endraw %}{% endif %}{% raw %}
{% endblock javascript %} {% endblock javascript %}
</body> </body>
</html> </html>

View File

@ -0,0 +1,50 @@
{% raw %}
{% load crispy_forms_field %}
{% if field.is_hidden %}
{{ field }}
{% else %}
{% if field|is_checkbox %}
<div class="form-group{% if using_grid_layout %} row{% endif %}">
{% if label_class %}
<div class="controls col-{{ bootstrap_device_type }}-offset-{{ label_size }} {{ field_class }}">
{% endif %}
{% endif %}
<{% if tag %}{{ tag }}{% else %}div{% endif %} id="div_{{ field.auto_id }}" {% if not field|is_checkbox %}class="form-group{% if using_grid_layout %} row{% endif %}{% else %}class="checkbox{% endif %}{% if wrapper_class %} {{ wrapper_class }}{% endif %}{% if form_show_errors%}{% if field.errors %} has-danger{% endif %}{% endif %}{% if field.css_classes %} {{ field.css_classes }}{% endif %}">
{% if field.label and not field|is_checkbox and form_show_labels %}
<label for="{{ field.id_for_label }}" class="form-control-label {{ label_class }}{% if field.field.required %} requiredField{% endif %}">
{{ field.label|safe }}{% if field.field.required %}<span class="asteriskField">*</span>{% endif %}
</label>
{% endif %}
{% if field|is_checkboxselectmultiple %}
{% include 'bootstrap4/layout/checkboxselectmultiple.html' %}
{% endif %}
{% if field|is_radioselect %}
{% include 'bootstrap4/layout/radioselect.html' %}
{% endif %}
{% if not field|is_checkboxselectmultiple and not field|is_radioselect %}
{% if field|is_checkbox and form_show_labels %}
<label for="{{ field.id_for_label }}" class="{% if field.field.required %} requiredField{% endif %}">
{% crispy_field field %}
{{ field.label|safe }}
{% include 'bootstrap4/layout/help_text_and_errors.html' %}
</label>
{% else %}
<div class="{{ field_class }}">
{% crispy_field field %}
</div>
{% include 'bootstrap4/layout/help_text_and_errors.html' %}
{% endif %}
{% endif %}
</{% if tag %}{{ tag }}{% else %}div{% endif %}>
{% if field|is_checkbox %}
{% if label_class %}
</div>
{% endif %}
</div>
{% endif %}
{% endif %}
{% endraw %}

View File

@ -0,0 +1,7 @@
{% raw %}
{% if form_show_errors and field.errors %}
{% for error in field.errors %}
<p id="error_{{ forloop.counter }}_{{ field.auto_id }}" class="text-danger help-block">{{ error }}</p>
{% endfor %}
{% endif %}
{% endraw %}

View File

@ -4,14 +4,14 @@
{% block title %}{{ user.username }}{% endblock %} {% block title %}{{ user.username }}{% endblock %}
{% block content %} {% block content %}
<h1>{{ user.username }}</h1> <h1>{{ user.username }}</h1>
<form class="form-horizontal" method="post" action="{% url 'users:update' %}"> <form class="form-horizontal" method="post" action="{% url 'users:update' %}">
{% csrf_token %} {% csrf_token %}
{{ form|crispy }} {{ form|crispy }}
<div class="control-group"> <div class="control-group">
<div class="controls"> <div class="controls">
<button type="submit" class="btn">Update</button> <button type="submit" class="btn">Update</button>
</div> </div>
</div> </div>
</form> </form>
{% endblock %}{% endraw %} {% endblock %}{% endraw %}

View File

@ -1,22 +1,17 @@
{% raw %}{% extends "base.html" %} {% raw %}{% extends "base.html" %}
{% load static %}{% load i18n %} {% load static i18n %}
{% block title %}Members{% endblock %} {% block title %}Members{% endblock %}
{% block content %} {% block content %}
<div class="container"> <div class="container">
<h2>Users</h2>
<h2>Users</h2> <div class="list-group">
{% for user in user_list %}
<div class="list-group"> <a href="{% url 'users:detail' user.username %}" class="list-group-item">
{% for user in user_list %} <h4 class="list-group-item-heading">{{ user.username }}</h4>
<a href="{% url 'users:detail' user.username %}" class="list-group-item"> </a>
<h4 class="list-group-item-heading">{{ user.username }}</h4> {% endfor %}
</a> </div>
{% endfor %}
</div>
</div> </div>
{% endblock content %}{% endraw %} {% endblock content %}{% endraw %}

View File

@ -5,7 +5,6 @@ from django import forms
from django.contrib import admin from django.contrib import admin
from django.contrib.auth.admin import UserAdmin as AuthUserAdmin from django.contrib.auth.admin import UserAdmin as AuthUserAdmin
from django.contrib.auth.forms import UserChangeForm, UserCreationForm from django.contrib.auth.forms import UserChangeForm, UserCreationForm
from .models import User from .models import User
@ -24,7 +23,7 @@ class MyUserCreationForm(UserCreationForm):
model = User model = User
def clean_username(self): def clean_username(self):
username = self.cleaned_data['username'] username = self.cleaned_data["username"]
try: try:
User.objects.get(username=username) User.objects.get(username=username)
except User.DoesNotExist: except User.DoesNotExist:
@ -33,6 +32,11 @@ class MyUserCreationForm(UserCreationForm):
@admin.register(User) @admin.register(User)
class UserAdmin(AuthUserAdmin): class MyUserAdmin(AuthUserAdmin):
form = MyUserChangeForm form = MyUserChangeForm
add_form = MyUserCreationForm add_form = MyUserCreationForm
fieldsets = (
('User Profile', {'fields': ('name',)}),
) + AuthUserAdmin.fieldsets
list_display = ('username', 'name', 'is_superuser')
search_fields = ['name']

View File

@ -0,0 +1,13 @@
from django.apps import AppConfig
class UsersConfig(AppConfig):
name = '{{cookiecutter.project_slug}}.users'
verbose_name = "Users"
def ready(self):
"""Override this to put in:
Users system checks
Users signal registration
"""
pass