From d1a763b9fed20e57e9a646eadc2684dcba0d7c98 Mon Sep 17 00:00:00 2001 From: Burhan Khalid Date: Fri, 8 Jan 2016 13:21:45 +0300 Subject: [PATCH 01/64] fixing typos (again) --- {{cookiecutter.repo_name}}/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/{{cookiecutter.repo_name}}/Dockerfile b/{{cookiecutter.repo_name}}/Dockerfile index 0cb397cd..f2f662d5 100644 --- a/{{cookiecutter.repo_name}}/Dockerfile +++ b/{{cookiecutter.repo_name}}/Dockerfile @@ -17,7 +17,7 @@ RUN chown -R django /app COPY ./compose/django/gunicorn.sh /gunicorn.sh COPY ./compose/django/entrypoint.sh /entrypoint.sh RUN sed -i 's/\r//' /entrypoint.sh -RUN set -i 's/\r//' /guincorn.sh +RUN sed -i 's/\r//' /gunicorn.sh RUN chmod +x /entrypoint.sh && chown django /entrypoint.sh RUN chmod +x /gunicorn.sh && chown django /gunicorn.sh From 2af079f7aa8ae480afa7e3a122b9186935274c2d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A1bio=20C=2E=20Barrionuevo=20da=20Luz?= Date: Mon, 9 Jan 2017 15:35:13 -0300 Subject: [PATCH 02/64] load .env file if DJANGO_READ_DOT_ENV_FILE is True --- .../config/settings/common.py | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/{{cookiecutter.project_slug}}/config/settings/common.py b/{{cookiecutter.project_slug}}/config/settings/common.py index c0c86b39..34ff52d9 100644 --- a/{{cookiecutter.project_slug}}/config/settings/common.py +++ b/{{cookiecutter.project_slug}}/config/settings/common.py @@ -16,7 +16,21 @@ ROOT_DIR = environ.Path(__file__) - 3 # ({{ cookiecutter.project_slug }}/config APPS_DIR = ROOT_DIR.path('{{ cookiecutter.project_slug }}') env = environ.Env() -env.read_env() + +# Load operating system environment variables and then prepare to use them +env = environ.Env() + +# .env file, should load only in development environment +READ_DOT_ENV_FILE = env('DJANGO_READ_DOT_ENV_FILE', default=False) + +if READ_DOT_ENV_FILE: + # Operating System Environment variables have precende over variables defined in the .env file, + # that is to say variables from the .env files will only be used if not defined + # as environment variables. + env_file = str(ROOT_DIR.path('.env')) + print('Loading : {}'.format(env_file)) + env.read_env(env_file) + print('The .env file has been loaded. See common.py for more information') # APP CONFIGURATION # ------------------------------------------------------------------------------ From 06603dda17a500ba8a63b1184168e0712c43dc7f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A1bio=20C=2E=20Barrionuevo=20da=20Luz?= Date: Mon, 9 Jan 2017 15:39:27 -0300 Subject: [PATCH 03/64] fix W291 trailing whitespace on common.py --- {{cookiecutter.project_slug}}/config/settings/common.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/{{cookiecutter.project_slug}}/config/settings/common.py b/{{cookiecutter.project_slug}}/config/settings/common.py index 34ff52d9..5afa7d99 100644 --- a/{{cookiecutter.project_slug}}/config/settings/common.py +++ b/{{cookiecutter.project_slug}}/config/settings/common.py @@ -24,7 +24,7 @@ env = environ.Env() READ_DOT_ENV_FILE = env('DJANGO_READ_DOT_ENV_FILE', default=False) if READ_DOT_ENV_FILE: - # Operating System Environment variables have precende over variables defined in the .env file, + # Operating System Environment variables have precende over variables defined in the .env file, # that is to say variables from the .env files will only be used if not defined # as environment variables. env_file = str(ROOT_DIR.path('.env')) From b0c771b6457a1c2e1983e78afd27b15193ee5f61 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A1bio=20C=2E=20Barrionuevo=20da=20Luz?= Date: Mon, 9 Jan 2017 15:53:30 -0300 Subject: [PATCH 04/64] include DJANGO_READ_DOT_ENV_FILE on env.example --- {{cookiecutter.project_slug}}/env.example | 1 + 1 file changed, 1 insertion(+) diff --git a/{{cookiecutter.project_slug}}/env.example b/{{cookiecutter.project_slug}}/env.example index 66a3570d..138b75fd 100644 --- a/{{cookiecutter.project_slug}}/env.example +++ b/{{cookiecutter.project_slug}}/env.example @@ -4,6 +4,7 @@ POSTGRES_PASSWORD=mysecretpass POSTGRES_USER=postgresuser # General settings +# DJANGO_READ_DOT_ENV_FILE=True DJANGO_ADMIN_URL= DJANGO_SETTINGS_MODULE=config.settings.production DJANGO_SECRET_KEY=CHANGEME!!! From 10fa9065998346176ec1bb9eedf20a8a4b50105f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A1bio=20C=2E=20Barrionuevo=20da=20Luz?= Date: Mon, 9 Jan 2017 16:02:53 -0300 Subject: [PATCH 05/64] add DJANGO_READ_DOT_ENV_FILE to settings docs --- docs/settings.rst | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/docs/settings.rst b/docs/settings.rst index eb6e92a4..893a47e9 100644 --- a/docs/settings.rst +++ b/docs/settings.rst @@ -3,7 +3,14 @@ Settings This project relies extensively on environment settings which **will not work with Apache/mod_wsgi setups**. It has been deployed successfully with both Gunicorn/Nginx and even uWSGI/Nginx. -For configuration purposes, the following table maps environment variables to their Django setting: +For configuration purposes, the following table maps environment variables to their Django setting and project settings: + + +======================================= =========================== ============================================== ====================================================================== +Environment Variable Django Setting Development Default Production Default +======================================= =========================== ============================================== ====================================================================== +DJANGO_READ_DOT_ENV_FILE READ_DOT_ENV_FILE False False +======================================= =========================== ============================================== ====================================================================== ======================================= =========================== ============================================== ====================================================================== From 12a8875dce4d7848eed116eee2b3b8b44e720e79 Mon Sep 17 00:00:00 2001 From: statwonk Date: Mon, 16 Jan 2017 21:18:07 -0600 Subject: [PATCH 06/64] Two Scoops 1.8 on p. 56 indicates base.txt is preferred for consistency --- .../config/settings/{common.py => base.py} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {{cookiecutter.project_slug}}/config/settings/{common.py => base.py} (100%) diff --git a/{{cookiecutter.project_slug}}/config/settings/common.py b/{{cookiecutter.project_slug}}/config/settings/base.py similarity index 100% rename from {{cookiecutter.project_slug}}/config/settings/common.py rename to {{cookiecutter.project_slug}}/config/settings/base.py From 62d86877e40f3ca9ff03d7423635634c23570ced Mon Sep 17 00:00:00 2001 From: statwonk Date: Mon, 16 Jan 2017 21:38:52 -0600 Subject: [PATCH 07/64] Missed a few references to the renamed settings file. This brings them inline. --- {{cookiecutter.project_slug}}/config/settings/local.py | 2 +- {{cookiecutter.project_slug}}/config/settings/production.py | 2 +- {{cookiecutter.project_slug}}/config/settings/test.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/{{cookiecutter.project_slug}}/config/settings/local.py b/{{cookiecutter.project_slug}}/config/settings/local.py index c72d3af1..969694bc 100644 --- a/{{cookiecutter.project_slug}}/config/settings/local.py +++ b/{{cookiecutter.project_slug}}/config/settings/local.py @@ -14,7 +14,7 @@ Local settings import socket import os -from .common import * # noqa +from .base import * # noqa # DEBUG # ------------------------------------------------------------------------------ diff --git a/{{cookiecutter.project_slug}}/config/settings/production.py b/{{cookiecutter.project_slug}}/config/settings/production.py index c1fccc95..94f78191 100644 --- a/{{cookiecutter.project_slug}}/config/settings/production.py +++ b/{{cookiecutter.project_slug}}/config/settings/production.py @@ -20,7 +20,7 @@ from django.utils import six import logging {% endif %} -from .common import * # noqa +from .base import * # noqa # SECRET CONFIGURATION # ------------------------------------------------------------------------------ diff --git a/{{cookiecutter.project_slug}}/config/settings/test.py b/{{cookiecutter.project_slug}}/config/settings/test.py index 6d07eb50..b1a43cd6 100644 --- a/{{cookiecutter.project_slug}}/config/settings/test.py +++ b/{{cookiecutter.project_slug}}/config/settings/test.py @@ -5,7 +5,7 @@ Test settings - Used to run tests fast on the continuous integration server and locally ''' -from .common import * # noqa +from .base import * # noqa # DEBUG From 83900ddfd39818411868ec9d2469ae0151c73baa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A1bio=20C=2E=20Barrionuevo=20da=20Luz?= Date: Fri, 3 Feb 2017 14:12:52 -0300 Subject: [PATCH 08/64] fix typo --- {{cookiecutter.project_slug}}/config/settings/common.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/{{cookiecutter.project_slug}}/config/settings/common.py b/{{cookiecutter.project_slug}}/config/settings/common.py index 5afa7d99..60ca7e6d 100644 --- a/{{cookiecutter.project_slug}}/config/settings/common.py +++ b/{{cookiecutter.project_slug}}/config/settings/common.py @@ -24,7 +24,7 @@ env = environ.Env() READ_DOT_ENV_FILE = env('DJANGO_READ_DOT_ENV_FILE', default=False) if READ_DOT_ENV_FILE: - # Operating System Environment variables have precende over variables defined in the .env file, + # Operating System Environment variables have precedence over variables defined in the .env file, # that is to say variables from the .env files will only be used if not defined # as environment variables. env_file = str(ROOT_DIR.path('.env')) From a2fe9199a6e35994912cdc3006abe9d744427433 Mon Sep 17 00:00:00 2001 From: Daniel Roy Greenfeld Date: Wed, 8 Feb 2017 09:02:24 -0800 Subject: [PATCH 09/64] Added bullet about security --- README.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/README.rst b/README.rst index b27ab9da..18fb3612 100644 --- a/README.rst +++ b/README.rst @@ -32,6 +32,7 @@ Features * Renders Django projects with 100% starting test coverage * Twitter Bootstrap_ v4.0.0 - `alpha 4`_ (`maintained Foundation fork`_ also available) * 12-Factor_ based settings via django-environ_ +* Secure by default. We believe in SSL. * Optimized development and production settings * Registration via django-allauth_ * Comes with custom user model ready to go From 19a4de576a378052affb83ca6a8f1866c0d0ad4e Mon Sep 17 00:00:00 2001 From: "pyup.io bot" Date: Thu, 9 Feb 2017 09:08:43 +0100 Subject: [PATCH 10/64] Update tox from 2.5.0 to 2.6.0 (#1017) --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 188fe018..2610ea31 100644 --- a/requirements.txt +++ b/requirements.txt @@ -7,5 +7,5 @@ binaryornot==0.4.0 pytest==3.0.6 pep8==1.7.0 pyflakes==1.5.0 -tox==2.5.0 +tox==2.6.0 pytest-cookies==0.2.0 From 7a50dcc89af09260501fbdb785f284495de81ca4 Mon Sep 17 00:00:00 2001 From: "pyup.io bot" Date: Thu, 9 Feb 2017 09:08:55 +0100 Subject: [PATCH 11/64] Update collectfast from 0.5.1 to 0.5.2 (#1024) --- {{cookiecutter.project_slug}}/requirements/production.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/{{cookiecutter.project_slug}}/requirements/production.txt b/{{cookiecutter.project_slug}}/requirements/production.txt index 9827cee5..38ddb222 100644 --- a/{{cookiecutter.project_slug}}/requirements/production.txt +++ b/{{cookiecutter.project_slug}}/requirements/production.txt @@ -19,7 +19,7 @@ gunicorn==19.6.0 boto==2.45.0 django-storages-redux==1.3.2 {% if cookiecutter.use_whitenoise != 'y' -%} -Collectfast==0.5.1 +Collectfast==0.5.2 {%- endif %} # Email backends for Mailgun, Postmark, SendGrid and more From 9bc7027fb0830ed62cea59f150e600e3359f8e44 Mon Sep 17 00:00:00 2001 From: "pyup.io bot" Date: Thu, 9 Feb 2017 09:09:19 +0100 Subject: [PATCH 12/64] Update cookiecutter from 1.5.0 to 1.5.1 (#1018) --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 2610ea31..0e548687 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,4 @@ -cookiecutter==1.5.0 +cookiecutter==1.5.1 flake8==3.2.1 # pyup: != 2.6.0 sh==1.12.9 binaryornot==0.4.0 From b430efa0edc6739ef845adb94888cabd6ed0cf5c Mon Sep 17 00:00:00 2001 From: "pyup.io bot" Date: Thu, 9 Feb 2017 09:10:22 +0100 Subject: [PATCH 13/64] Update flake8 to 3.3.0 (#1021) * Update flake8 from 3.2.1 to 3.3.0 * Update flake8 from 3.2.1 to 3.3.0 --- {{cookiecutter.project_slug}}/requirements/test.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/{{cookiecutter.project_slug}}/requirements/test.txt b/{{cookiecutter.project_slug}}/requirements/test.txt index 5c46d128..afb97ded 100644 --- a/{{cookiecutter.project_slug}}/requirements/test.txt +++ b/{{cookiecutter.project_slug}}/requirements/test.txt @@ -8,7 +8,7 @@ psycopg2==2.6.2 {%- endif %} coverage==4.3.4 -flake8==3.2.1 # pyup: != 2.6.0 +flake8==3.3.0 # pyup: != 2.6.0 django-test-plus==1.0.17 factory-boy==2.8.1 From 51609953a87f88d109a075240d67845dbdfb3b0b Mon Sep 17 00:00:00 2001 From: "pyup.io bot" Date: Thu, 9 Feb 2017 09:10:37 +0100 Subject: [PATCH 14/64] Update django-coverage-plugin to 1.4.2 (#1022) * Update django-coverage-plugin from 1.4.1 to 1.4.2 * Update django-coverage-plugin from 1.4.1 to 1.4.2 --- requirements_to_watch.txt | 2 +- {{cookiecutter.project_slug}}/requirements/local.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/requirements_to_watch.txt b/requirements_to_watch.txt index aecc8e7c..3e154af2 100644 --- a/requirements_to_watch.txt +++ b/requirements_to_watch.txt @@ -1,4 +1,4 @@ # These requirements prevented an upgrade to Django 1.10. -django-coverage-plugin==1.4.1 +django-coverage-plugin==1.4.2 django-autoslug==1.9.3 diff --git a/{{cookiecutter.project_slug}}/requirements/local.txt b/{{cookiecutter.project_slug}}/requirements/local.txt index 855a1f4b..03cf457b 100644 --- a/{{cookiecutter.project_slug}}/requirements/local.txt +++ b/{{cookiecutter.project_slug}}/requirements/local.txt @@ -2,7 +2,7 @@ -r base.txt coverage==4.3.4 -django-coverage-plugin==1.4.1 +django-coverage-plugin==1.4.2 Sphinx==1.5.2 django-extensions==1.7.6 From 5b75a9ccf2a1269db7915e1c0dbf5156d13adbed Mon Sep 17 00:00:00 2001 From: Matt Braymer-Hayes Date: Fri, 10 Feb 2017 00:21:04 -0800 Subject: [PATCH 15/64] 1029: Fix typo in Docker deployment docs (#1030) * #1029 Replace "wan't" with "want" * #1029 Add self to CONTRIBUTORS.rst --- CONTRIBUTORS.rst | 2 ++ docs/deployment-with-docker.rst | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CONTRIBUTORS.rst b/CONTRIBUTORS.rst index 414d2a33..7163cec1 100644 --- a/CONTRIBUTORS.rst +++ b/CONTRIBUTORS.rst @@ -107,6 +107,7 @@ Listed in alphabetical order. Lyla Fischer Martin Blech Mathijs Hoogland `@MathijsHoogland`_ + Matt Braymer-Hayes `@mattayes`_ @mattayes Matt Linares Matt Menzenski `@menzenski`_ Matt Warren `@mfwarren`_ @@ -193,6 +194,7 @@ Listed in alphabetical order. .. _@knitatoms: https://github.com/knitatoms .. _@krzysztofzuraw: https://github.com/krzysztofzuraw .. _@MathijsHoogland: https://github.com/MathijsHoogland +.. _@mattayes: https://github.com/mattayes .. _@menzenski: https://github.com/menzenski .. _@mfwarren: https://github.com/mfwarren .. _@mimischi: https://github.com/mimischi diff --git a/docs/deployment-with-docker.rst b/docs/deployment-with-docker.rst index 03aefd48..ac266993 100644 --- a/docs/deployment-with-docker.rst +++ b/docs/deployment-with-docker.rst @@ -143,7 +143,7 @@ If you have errors, you can always check your stack with `docker-compose`. Switc Supervisor Example ------------------- -Once you are ready with your initial setup, you wan't to make sure that your application is run by a process manager to +Once you are ready with your initial setup, you want to make sure that your application is run by a process manager to survive reboots and auto restarts in case of an error. You can use the process manager you are most familiar with. All it needs to do is to run `docker-compose up` in your projects root directory. From d4f6f0b99c41fb06cfc3d41b49396e449bea7eae Mon Sep 17 00:00:00 2001 From: "Nikita P. Shupeyko" Date: Fri, 10 Feb 2017 14:33:29 +0300 Subject: [PATCH 16/64] Fix Docker test PyCharm Run Configurations settings file Switch from env name="DJANGO_SETTINGS_MODULE" value="config.settings.local" to env name="DJANGO_SETTINGS_MODULE" value="config.settings.test" --- .../.idea/runConfigurations/Docker__tests___all.xml | 2 +- .../.idea/runConfigurations/Docker__tests___class__TestUser.xml | 2 +- .../runConfigurations/Docker__tests___file__test_models.xml | 2 +- .../.idea/runConfigurations/Docker__tests___module__users.xml | 2 +- .../Docker__tests___specific__test_get_absolute_url.xml | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/{{cookiecutter.project_slug}}/.idea/runConfigurations/Docker__tests___all.xml b/{{cookiecutter.project_slug}}/.idea/runConfigurations/Docker__tests___all.xml index 7ede8bfb..02fba079 100644 --- a/{{cookiecutter.project_slug}}/.idea/runConfigurations/Docker__tests___all.xml +++ b/{{cookiecutter.project_slug}}/.idea/runConfigurations/Docker__tests___all.xml @@ -4,7 +4,7 @@