Merge branch 'master' of https://github.com/pydanny/cookiecutter-django into pydanny-master

This commit is contained in:
Gregg Sangster 2016-09-12 09:13:51 -04:00
commit 73584f312e
74 changed files with 1444 additions and 552 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,44 @@
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] ##[2016-06-17]
## Added ## Added
- django-compressor support (@andresgz) - django-compressor support (@andresgz)

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,6 +45,7 @@ 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`_ Andres Gonzalez `@andresgz`_
Andrew Mikhnevich `@zcho`_ Andrew Mikhnevich `@zcho`_
Andy Rose Andy Rose
@ -59,6 +60,7 @@ 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`_
@ -67,9 +69,12 @@ Listed in alphabetical order.
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
@ -106,6 +111,8 @@ Listed in alphabetical order.
Meghan Heintz `@dot2dotseurat`_ 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`_
@ -114,6 +121,7 @@ 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`_ Sule Marshall `@suledev`_
Taylor Baldwin Taylor Baldwin
Théo Segonds `@show0k`_ Théo Segonds `@show0k`_
@ -122,6 +130,7 @@ Listed in alphabetical order.
Travis McNeill `@Travistock`_ @tavistock_esq Travis McNeill `@Travistock`_ @tavistock_esq
Vitaly Babiy Vitaly Babiy
Vivian Guillen `@viviangb`_ Vivian Guillen `@viviangb`_
Will Farley `@goldhand`_ @g01dhand
Yaroslav Halchenko Yaroslav Halchenko
========================== ============================ ============== ========================== ============================ ==============
@ -129,11 +138,13 @@ Listed in alphabetical order.
.. _@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 .. _@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 .. _@blopker: https://github.com/blopker
.. _@bogdal: https://github.com/bogdal .. _@bogdal: https://github.com/bogdal
@ -143,11 +154,13 @@ 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 .. _@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 .. _@dezoito: https://github.com/dezoito
.. _@dhepper: https://github.com/dhepper
.. _@dot2dotseurat: https://github.com/dot2dotseurat .. _@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
@ -156,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
@ -179,12 +193,15 @@ Listed in alphabetical order.
.. _@noisy: https://github.com/noisy .. _@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
.. _@parbhat: https://github.com/parbhat
.. _@raonyguimaraes: https://github.com/raonyguimaraes .. _@raonyguimaraes: https://github.com/raonyguimaraes
.. _@romanosipenko: https://github.com/romanosipenko .. _@romanosipenko: https://github.com/romanosipenko
.. _@shireenrao: https://github.com/shireenrao .. _@shireenrao: https://github.com/shireenrao
.. _@show0k: https://github.com/show0k .. _@show0k: https://github.com/show0k
.. _@shultz: https://github.com/shultz
.. _@siauPatrick: https://github.com/siauPatrick .. _@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 .. _@suledev: https://github.com/suledev
.. _@Travistock: https://github.com/Tavistock .. _@Travistock: https://github.com/Tavistock
@ -196,6 +213,7 @@ Listed in alphabetical order.
.. _@phiberjenz: https://github.com/phiberjenz .. _@phiberjenz: https://github.com/phiberjenz
.. _@sladinji: https://github.com/sladinji .. _@sladinji: https://github.com/sladinji
.. _@andresgz: https://github.com/andresgz .. _@andresgz: https://github.com/andresgz
.. _@jangeador: https://github.com/jangeador
Special Thanks Special Thanks
~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~

43
LICENSE
View File

@ -1,17 +1,4 @@
{% if cookiecutter.open_source_license == 'MIT' %} Copyright (c) 2013-2016, Daniel Greenfeld
MIT License
Copyright (c) {% now 'local', '%Y' %}, {{ cookiecutter.full_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:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of 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' %}
BSD License
Copyright (c) {% now 'local', '%Y' %}, {{ cookiecutter.full_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,
@ -24,9 +11,9 @@ are permitted provided that the following conditions are met:
list of conditions and the following disclaimer in the documentation and/or list of conditions and the following disclaimer in the documentation and/or
other materials provided with the distribution. other materials provided with the distribution.
* Neither the name of {{ cookiecutter.project_name }} nor the names of its * Neither the name of Cookiecutter Django nor the names of its contributors may
contributors may be used to endorse or promote products derived from this be used to endorse or promote products derived from this software without
software without specific prior written permission. specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
@ -34,25 +21,7 @@ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIME
IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE 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 == 'Apache Software License 2.0' %}
Apache Software License 2.0
Copyright (c) {% now 'local', '%Y' %}, {{ cookiecutter.full_name }}
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
{% endif %}

View File

@ -14,7 +14,7 @@ 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 * Documentation: https://cookiecutter-django.readthedocs.io/en/latest/
* See Troubleshooting_ for common errors and obstacles * See Troubleshooting_ for common errors and obstacles
.. _cookiecutter: https://github.com/audreyr/cookiecutter .. _cookiecutter: https://github.com/audreyr/cookiecutter
@ -28,11 +28,11 @@ 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`_
* 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
* Send emails via Anymail_ (using Mailgun_ by default, but switchable) * Send emails via Anymail_ (using Mailgun_ by default, but switchable)
* Media storage using Amazon S3 * Media storage using Amazon S3
@ -41,6 +41,7 @@ Features
* 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
@ -52,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
.. _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 .. _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/
@ -78,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).
@ -108,10 +107,10 @@ 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
@ -123,15 +122,30 @@ Answer the prompts with your own desired options_. For example::
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
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::
@ -148,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`_
@ -160,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`_.
@ -181,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?
@ -204,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
@ -219,11 +233,11 @@ 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
@ -242,6 +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/ .. _`PyPA Code of Conduct`: https://www.pypa.io/en/latest/code-of-conduct/

View File

@ -1,8 +1,8 @@
{ {
"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",
@ -14,12 +14,13 @@
"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_compressor": "n", "use_compressor": "n",
"postgresql_version": ["9.5", "9.4", "9.3", "9.2"],
"js_task_runner": ["Gulp", "Grunt", "None"], "js_task_runner": ["Gulp", "Grunt", "None"],
"use_lets_encrypt": "n", "use_lets_encrypt": "n",
"use_gitlab_ci": ["No", "Test Only", "Test and Deploy"], "use_gitlab_ci": ["No", "Test Only", "Test and Deploy"],
"open_source_license": ["MIT", "BSD", "Apache Software License 2.0", "Not open source"] "open_source_license": ["MIT", "BSD", "GPLv3", "Apache Software License 2.0", "Not open source"]
} }

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

@ -89,7 +89,7 @@ If you would like to set up autorenewal of your certificates, the following comm
#!/bin/bash #!/bin/bash
cd <project directory> cd <project directory>
docker-compose run 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-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 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):: And then set a cronjob by running `crontab -e` and placing in it (period can be adjusted as desired)::

View File

@ -37,17 +37,60 @@ 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_for_error_reporting [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.*
use_gitlab_ci ["No"] use_gitlab_ci ["No"]
Whether to use GitLab CI for testing and continuous deployment. Whether to use GitLab CI for testing and continuous deployment.
@ -56,3 +99,16 @@ use_gitlab_ci ["No"]
.. _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

View File

@ -184,6 +184,15 @@ def remove_gitlab_ci_files():
file_name = os.path.join(django_dir_location, filename) file_name = os.path.join(django_dir_location, filename)
remove_file(file_name) 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(
PROJECT_DIRECTORY, filename
))
# IN PROGRESS # IN PROGRESS
# def copy_doc_files(project_directory): # def copy_doc_files(project_directory):
# cookiecutters_dir = DEFAULT_CONFIG['cookiecutters_dir'] # cookiecutters_dir = DEFAULT_CONFIG['cookiecutters_dir']
@ -277,5 +286,9 @@ if '{{ cookiecutter.use_gitlab_ci }}'.lower() != 'no' and '{{ cookiecutter.use_d
"You selected to use GitLab CI. Please see the documentation for instructions on how to set up the GitLab CI environment" "You selected to use GitLab CI. Please see the documentation for instructions on how to set up the GitLab CI environment"
) )
# 14. Copy files from /docs/ to {{ cookiecutter.project_slug }}/docs/ # 14. Removes files needed for the GPLv3 licence if it isn't going to be used.
if '{{ cookiecutter.open_source_license}}' != 'GPLv3':
remove_copying_files()
# 15. Copy files from /docs/ to {{ cookiecutter.project_slug }}/docs/
# copy_doc_files(PROJECT_DIRECTORY) # copy_doc_files(PROJECT_DIRECTORY)

View File

@ -1,11 +1,11 @@
cookiecutter==1.4.0 cookiecutter==1.4.0
flake8==2.6.0 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.2 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.6b' 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

@ -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

@ -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,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,7 +102,6 @@ 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_for_error_reporting == "y" %}
Sentry Sentry
@ -113,13 +111,12 @@ Sentry is an error logging aggregator service. You can sign up for a free accoun
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

@ -27,7 +27,12 @@
"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

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

@ -5,4 +5,5 @@ ADD nginx.conf /etc/nginx/nginx.conf
ADD start.sh /start.sh ADD start.sh /start.sh
ADD nginx-secure.conf /etc/nginx/nginx-secure.conf ADD nginx-secure.conf /etc/nginx/nginx-secure.conf
ADD dhparams.pem /etc/ssl/private/dhparams.pem ADD dhparams.pem /etc/ssl/private/dhparams.pem
CMD /start.sh
{% endif %} {% endif %}

View File

@ -37,10 +37,12 @@ http {
server_name ___my.example.com___ www.___my.example.com___; server_name ___my.example.com___ www.___my.example.com___;
location /.well-known/acme-challenge { location /.well-known/acme-challenge {
proxy_pass http://___LETSENCRYPT_IP___:___LETSENCRYPT_PORT___; # 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 Host $host;
proxy_set_header X-Forwarded-For $remote_addr; proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header X-Forwarded-Proto https;
proxy_set_header X-Forwarded-Proto $scheme; proxy_set_header X-Forwarded-Proto $scheme;
} }
@ -66,7 +68,9 @@ http {
ssl_dhparam /etc/ssl/private/dhparams.pem; ssl_dhparam /etc/ssl/private/dhparams.pem;
location /.well-known/acme-challenge { location /.well-known/acme-challenge {
proxy_pass http://___LETSENCRYPT_HTTPS_IP___:___LETSENCRYPT_HTTPS_PORT___; resolver ___NAMESERVER___;
set $certbot_addr_port certbot:443;
proxy_pass http://$certbot_addr_port;
proxy_set_header Host $host; proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $remote_addr; proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header X-Forwarded-Proto https; proxy_set_header X-Forwarded-Proto https;

View File

@ -39,7 +39,7 @@ http {
server_name ___my.example.com___ ; server_name ___my.example.com___ ;
location /.well-known/acme-challenge { location /.well-known/acme-challenge {
proxy_pass http://___LETSENCRYPT_IP___:___LETSENCRYPT_PORT___; proxy_pass http://certbot:80;
proxy_set_header Host $host; proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $remote_addr; proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header X-Forwarded-Proto https; proxy_set_header X-Forwarded-Proto https;

View File

@ -5,18 +5,9 @@ echo build starting nginx config
echo replacing ___my.example.com___/$MY_DOMAIN_NAME echo replacing ___my.example.com___/$MY_DOMAIN_NAME
echo replacing ___LETSENCRYPT_IP___/$LETSENCRYPT_PORT_80_TCP_ADDR
echo replacing ___LETSENCRYPT_PORT___/$LETSENCRYPT_PORT_80_TCP_PORT
echo replacing ___APPLICATION_IP___/$APP_PORT_80_TCP_ADDR
echo replacing ___APPLICATION_PORT___/$APP_PORT_80_TCP_PORT
# Put your domain name into the nginx reverse proxy config. # Put your domain name into the nginx reverse proxy config.
sed -i "s/___my.example.com___/$MY_DOMAIN_NAME/g" /etc/nginx/nginx.conf sed -i "s/___my.example.com___/$MY_DOMAIN_NAME/g" /etc/nginx/nginx.conf
# Add your app's container IP and port into config
sed -i "s/___APPLICATION_IP___/$APP_PORT_80_TCP_ADDR/g" /etc/nginx/nginx.conf
sed -i "s/___APPLICATION_PORT___/$APP_PORT_80_TCP_PORT/g" /etc/nginx/nginx.conf
sed -i "s/___LETSENCRYPT_IP___/$LETSENCRYPT_PORT_80_TCP_ADDR/g" /etc/nginx/nginx.conf
sed -i "s/___LETSENCRYPT_PORT___/$LETSENCRYPT_PORT_80_TCP_PORT/g" /etc/nginx/nginx.conf
cat /etc/nginx/nginx.conf cat /etc/nginx/nginx.conf
echo . echo .
@ -53,29 +44,19 @@ done
sleep 15 sleep 15
echo replacing ___my.example.com___/$MY_DOMAIN_NAME echo replacing ___my.example.com___/$MY_DOMAIN_NAME
echo replacing ___LETSENCRYPT_IP___/$LETSENCRYPT_PORT_80_TCP_ADDR
echo replacing ___LETSENCRYPT_PORT___/$LETSENCRYPT_PORT_80_TCP_PORT
echo replacing ___LETSENCRYPT_HTTPS_IP___/$LETSENCRYPT_PORT_443_TCP_ADDR
echo replacing ___LETSENCRYPT_HTTPS_PORT___/$LETSENCRYPT_PORT_443_TCP_PORT
echo replacing ___APPLICATION_IP___/$APP_PORT_80_TCP_ADDR
echo replacing ___APPLICATION_PORT___/$APP_PORT_80_TCP_PORT
# Put your domain name into the nginx reverse proxy config. # 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 sed -i "s/___my.example.com___/$MY_DOMAIN_NAME/g" /etc/nginx/nginx-secure.conf
# Add LE container IP and port into config # Add the system's nameserver (the docker network dns) so we can resolve container names in nginx
sed -i "s/___LETSENCRYPT_IP___/$LETSENCRYPT_PORT_80_TCP_ADDR/g" /etc/nginx/nginx-secure.conf NAMESERVER=`cat /etc/resolv.conf | grep "nameserver" | awk '{print $2}' | tr '\n' ' '`
sed -i "s/___LETSENCRYPT_PORT___/$LETSENCRYPT_PORT_80_TCP_PORT/g" /etc/nginx/nginx-secure.conf echo replacing ___NAMESERVER___/$NAMESERVER
sed -i "s/___LETSENCRYPT_HTTPS_IP___/$LETSENCRYPT_PORT_443_TCP_ADDR/g" /etc/nginx/nginx-secure.conf sed -i "s/___NAMESERVER___/$NAMESERVER/g" /etc/nginx/nginx-secure.conf
sed -i "s/___LETSENCRYPT_HTTPS_PORT___/$LETSENCRYPT_PORT_443_TCP_PORT/g" /etc/nginx/nginx-secure.conf
# Add your app's container IP and port into config
sed -i "s/___APPLICATION_IP___/$APP_PORT_80_TCP_ADDR/g" /etc/nginx/nginx-secure.conf
sed -i "s/___APPLICATION_PORT___/$APP_PORT_80_TCP_PORT/g" /etc/nginx/nginx-secure.conf
#go! #go!
kill $(ps aux | grep 'nginx' | awk '{print $2}') kill $(ps aux | grep 'nginx' | grep -v 'grep' | awk '{print $2}')
cp /etc/nginx/nginx-secure.conf /etc/nginx/nginx.conf cp /etc/nginx/nginx-secure.conf /etc/nginx/nginx.conf
nginx -g 'daemon off;' 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
) )
@ -164,7 +165,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,12 +231,16 @@ 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 # django-compressor
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
{% if cookiecutter.use_compressor == 'y'-%}
INSTALLED_APPS += ("compressor", ) INSTALLED_APPS += ("compressor", )
STATICFILES_FINDERS += ("compressor.finders.CompressorFinder", ) STATICFILES_FINDERS += ("compressor.finders.CompressorFinder", )
{%- endif %} {%- endif %}
@ -244,3 +249,4 @@ STATICFILES_FINDERS += ("compressor.finders.CompressorFinder", )
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,14 +3,18 @@
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
""" """
from .common import * # noqa
import socket import socket
import os import os
from .common import * # noqa
# DEBUG # DEBUG
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
@ -53,7 +57,7 @@ INTERNAL_IPS = ['127.0.0.1', '10.0.2.2', ]
# tricks to have debug toolbar when developing with docker # tricks to have debug toolbar when developing with docker
if os.environ.get('USE_DOCKER') == 'yes': if os.environ.get('USE_DOCKER') == 'yes':
ip = socket.gethostbyname(socket.gethostname()) ip = socket.gethostbyname(socket.gethostname())
INTERNAL_IPS += [ip[:-1]+"1"] INTERNAL_IPS += [ip[:-1] + "1"]
DEBUG_TOOLBAR_CONFIG = { DEBUG_TOOLBAR_CONFIG = {
'DISABLE_PANELS': [ 'DISABLE_PANELS': [
@ -76,3 +80,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,10 +2,9 @@
""" """
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_for_error_reporting == 'y' %} {% if cookiecutter.use_sentry_for_error_reporting == 'y' %}
- Use sentry for error logging - Use sentry for error logging
{% endif %} {% endif %}
@ -305,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

@ -17,7 +17,7 @@ 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:

View File

@ -16,9 +16,10 @@ var gulp = require('gulp'),
pixrem = require('gulp-pixrem'), pixrem = require('gulp-pixrem'),
uglify = require('gulp-uglify'), uglify = require('gulp-uglify'),
imagemin = require('gulp-imagemin'), imagemin = require('gulp-imagemin'),
exec = require('gulp-exec'), exec = require('child_process').exec,
runSequence = require('run-sequence'), runSequence = require('run-sequence'),
browserSync = require('browser-sync'); browserSync = require('browser-sync').create(),
reload = browserSync.reload;
// Relative paths function // Relative paths function
@ -100,8 +101,8 @@ gulp.task('default', function() {
gulp.task('watch', ['default'], function() { gulp.task('watch', ['default'], function() {
gulp.watch(paths.sass + '/*.scss', ['styles']); gulp.watch(paths.sass + '/*.scss', ['styles']);
gulp.watch(paths.js + '/*.js', ['scripts']); gulp.watch(paths.js + '/*.js', ['scripts']).on("change", reload);
gulp.watch(paths.images + '/*', ['imgCompression']); gulp.watch(paths.images + '/*', ['imgCompression']);
gulp.watch('templates/*.html'); gulp.watch(paths.templates + '/**/*.html').on("change", reload);
}); });

View File

@ -16,20 +16,19 @@
"pixrem": "~1.3.1", "pixrem": "~1.3.1",
"time-grunt": "~1.2.1" "time-grunt": "~1.2.1"
{% elif cookiecutter.js_task_runner == 'Gulp' %} {% elif cookiecutter.js_task_runner == 'Gulp' %}
"browser-sync": "^2.12.10", "browser-sync": "^2.14.0",
"del": "^2.2.0", "del": "^2.2.2",
"gulp": "^3.9.1", "gulp": "^3.9.1",
"gulp-autoprefixer": "^3.1.0", "gulp-autoprefixer": "^3.1.1",
"gulp-cssnano": "^2.1.2", "gulp-cssnano": "^2.1.2",
"gulp-exec": "^2.1.2", "gulp-imagemin": "^3.0.3",
"gulp-imagemin": "^3.0.1",
"gulp-pixrem": "^1.0.0", "gulp-pixrem": "^1.0.0",
"gulp-plumber": "^1.1.0", "gulp-plumber": "^1.1.0",
"gulp-rename": "^1.2.2", "gulp-rename": "^1.2.2",
"gulp-sass": "^2.3.1", "gulp-sass": "^2.3.2",
"gulp-uglify": "^1.5.3", "gulp-uglify": "^2.0.0",
"gulp-util": "^3.0.7", "gulp-util": "^3.0.7",
"run-sequence": "^1.2.1" "run-sequence": "^1.2.2"
{% endif %} {% endif %}
}, },
"engines": { "engines": {

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,47 +7,46 @@ wheel==0.29.0
{%- endif %} {%- endif %}
# Bleeding edge Django # Bleeding edge Django
django==1.9.7 django==1.9.9
# Configuration # Configuration
django-environ==0.4.0 django-environ==0.4.0
{% if cookiecutter.use_whitenoise == 'y' -%} {% if cookiecutter.use_whitenoise == 'y' -%}
whitenoise==3.2 whitenoise==3.2.1
{%- endif %} {%- endif %}
# Forms # Forms
django-braces==1.9.0 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.3 django-redis==4.4.4
redis>=2.10.0 redis>=2.10.0
{% if cookiecutter.use_celery == "y" %} {% if cookiecutter.use_celery == "y" %}
@ -55,7 +54,8 @@ celery==3.1.23
{% endif %} {% endif %}
{% if cookiecutter.use_compressor == "y" %} {% if cookiecutter.use_compressor == "y" %}
django_compressor==2.0 rcssmin==1.0.6 {% if cookiecutter.windows == 'y' %}--install-option="--without-c-extensions"{% endif %}
django-compressor==2.1
{% endif %} {% endif %}
# Your custom requirements go here # Your custom requirements go here

View File

@ -1,13 +1,13 @@
# Local development dependencies go here # Local development dependencies go here
-r base.txt -r base.txt
coverage==4.1 coverage==4.2
django-coverage-plugin==1.3.1 django-coverage-plugin==1.3.1
Sphinx==1.4.4 Sphinx==1.4.5
django-extensions==1.6.7 django-extensions==1.7.4
Werkzeug==0.11.10 Werkzeug==0.11.11
django-test-plus==1.0.13 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.1 ipdb==0.10.1

View File

@ -6,17 +6,17 @@
# 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.6.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
@ -24,16 +24,16 @@ Collectfast==0.2.3
# Email backends for Mailgun, Postmark, SendGrid and more # Email backends for Mailgun, Postmark, SendGrid and more
# ------------------------------------------------------- # -------------------------------------------------------
django-anymail==0.3.1 django-anymail==0.4.2
{% if cookiecutter.use_sentry_for_error_reporting == "y" -%} {% if cookiecutter.use_sentry_for_error_reporting == "y" -%}
# Raven is the Sentry client # Raven is the Sentry client
# -------------------------- # --------------------------
raven==5.21.0 raven==5.26.0
{%- endif %} {%- endif %}
{% if cookiecutter.use_opbeat == "y" -%} {% if cookiecutter.use_opbeat == "y" -%}
# Opbeat agent for performance monitoring # Opbeat agent for performance monitoring
# ----------------------------------------- # -----------------------------------------
opbeat==3.3.3 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.1 coverage==4.2
django-coverage-plugin==1.3.1 flake8==3.0.4 # pyup: != 2.6.0
flake8==2.6.0 django-test-plus==1.0.15
django-test-plus==1.0.13
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

@ -2,39 +2,48 @@
WORK_DIR="$(dirname "$0")" WORK_DIR="$(dirname "$0")"
DISTRO_NAME=$(lsb_release -sc) DISTRO_NAME=$(lsb_release -sc)
OS_REQUIREMENTS_FILENAME="requirements-$DISTRO_NAME.apt"
OS_REQUIREMENTS_FILENAME="$WORK_DIR/requirements-$DISTRO_NAME.apt" cd $WORK_DIR
# Check if a requirements file exist for the current distribution.
if [ "$DISTRO_NAME" != "xenial" ] && [ "$DISTRO_NAME" != "trusty" ] && [ "$DISTRO_NAME" != "jessie" ]; then if [ ! -r "$OS_REQUIREMENTS_FILENAME" ]; then
echo "Only the Ubuntu 14.04 (Trusty), 16.04 (Xenial) and Debian 8.x (Jessie) is supported by this script"; cat <<-EOF >&2
echo "You can see requirements-trusty.apt, requirements-xenial.apt or requirements-jessie.apt file to help search the equivalent package in your system"; There is no requirements file for your distribution.
exit 1; 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_packages() function install_packages()
@ -47,18 +56,17 @@ 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 ./$WORK_DIR/${0##*/} $PARAN" 2>&1 Please do:
echo -e "\n" 2>&1 sudo $WORK_DIR/${0##*/} $PARAN
EOF
exit 1 exit 1
else else
@ -76,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

@ -3,7 +3,7 @@
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

View File

@ -3,7 +3,7 @@
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

View File

@ -3,7 +3,7 @@
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

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

@ -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,7 +22,8 @@ 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_for_error_reporting == 'y' -%} {% if cookiecutter.use_sentry_for_error_reporting == 'y' -%}
if hasattr(settings, 'RAVEN_CONFIG'): if hasattr(settings, 'RAVEN_CONFIG'):

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

@ -14,12 +14,12 @@
<![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://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.2/css/bootstrap.min.css" integrity="sha384-y3tfxAZXuh4HwSYylfB+J125MxIs6mR5FOHamPBG064zB+AFeWH94NdvaCBm8qnd" crossorigin="anonymous"> <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 %} {% 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 %} {% endraw %}{% if cookiecutter.use_compressor == "y" %}{% raw %}{% endcompress %}{% endraw %}{% endif %}{% raw %}
{% endblock %} {% endblock %}
@ -28,7 +28,7 @@
<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>
@ -53,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>
@ -89,14 +89,10 @@
================================================== --> ================================================== -->
<!-- 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://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.2/js/bootstrap.min.js" integrity="sha384-vZ2WRJMwsjRMW/8U7i6PWi6AlO1L79snBrmgiDpgIWJ82z8eA5lenwvxbMV1PAh7" crossorigin="anonymous"></script>
<!-- Your stuff: Third-party javascript libraries go here --> <!-- Your stuff: Third-party javascript libraries go here -->

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

@ -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