From 88d3a4cc8cb6973faa8deaabaf39ba387f3303e3 Mon Sep 17 00:00:00 2001 From: Reggie Riser Date: Thu, 28 Dec 2017 15:52:22 -0500 Subject: [PATCH 01/41] Fixing leftovers from migration to Django 1.11 and Python 3.6. --- CONTRIBUTING.rst | 4 ++-- docs/deployment-on-pythonanywhere.rst | 2 +- docs/deployment-with-elastic-beanstalk.rst | 2 +- hooks/pre_gen_project.py | 4 ++-- requirements_to_watch.txt | 4 +--- setup.py | 5 ++--- {{cookiecutter.project_slug}}/.travis.yml | 2 +- .../compose/local/django/Dockerfile | 2 +- .../compose/production/django/Dockerfile | 2 +- {{cookiecutter.project_slug}}/docs/docker_ec2.rst | 2 +- {{cookiecutter.project_slug}}/runtime.txt | 2 +- .../{{cookiecutter.project_slug}}/users/models.py | 2 +- .../{{cookiecutter.project_slug}}/users/tests/test_urls.py | 2 +- .../{{cookiecutter.project_slug}}/users/views.py | 5 ++--- 14 files changed, 18 insertions(+), 22 deletions(-) diff --git a/CONTRIBUTING.rst b/CONTRIBUTING.rst index efff1fad..0e4e258c 100644 --- a/CONTRIBUTING.rst +++ b/CONTRIBUTING.rst @@ -39,9 +39,9 @@ To run all tests using various versions of python in virtualenvs defined in tox. It is possible to tests with some versions of python, to do this the command is:: - $ tox -e py34,py35 + $ tox -e py35,py36 -Will run py.test with the python3.4, and python3.5 interpreters, for +Will run py.test with the python3.5, and python3.6 interpreters, for example. To run a particular test with tox for against your current Python version:: diff --git a/docs/deployment-on-pythonanywhere.rst b/docs/deployment-on-pythonanywhere.rst index 07b46bc0..d70684bd 100644 --- a/docs/deployment-on-pythonanywhere.rst +++ b/docs/deployment-on-pythonanywhere.rst @@ -35,7 +35,7 @@ Make sure your project is fully commited and pushed up to Bitbucket or Github or git clone # you can also use hg cd my-project-name - mkvirtualenv --python=/usr/bin/python3.5 my-project-name + mkvirtualenv --python=/usr/bin/python3.6 my-project-name pip install -r requirements/production.txt # may take a few minutes diff --git a/docs/deployment-with-elastic-beanstalk.rst b/docs/deployment-with-elastic-beanstalk.rst index e8aae885..5edf1795 100644 --- a/docs/deployment-with-elastic-beanstalk.rst +++ b/docs/deployment-with-elastic-beanstalk.rst @@ -20,7 +20,7 @@ Instructions If you haven't done so, create a directory of environments:: - eb init -p python3.4 MY_PROJECT_SLUG + eb init -p python3.6 MY_PROJECT_SLUG Replace `MY_PROJECT_SLUG` with the value you entered for `project_slug`. diff --git a/hooks/pre_gen_project.py b/hooks/pre_gen_project.py index c7a68450..d509a464 100644 --- a/hooks/pre_gen_project.py +++ b/hooks/pre_gen_project.py @@ -16,7 +16,7 @@ if docker == 'n': python_major_version = sys.version_info[0] if python_major_version == 2: - sys.stdout.write("WARNING: Cookiecutter Django does not support Python 2! Stability is guaranteed with Python 3.4+ only. Are you sure you want to proceed? (y/n)") + sys.stdout.write("WARNING: Cookiecutter Django does not support Python 2! Stability is guaranteed with Python 3.6+ only. Are you sure you want to proceed? (y/n)") yes_options = set(['y']) no_options = set(['n', '']) @@ -26,6 +26,6 @@ if docker == 'n': elif choice in yes_options: pass else: - sys.stdout.write("Please respond with %s or %s" + sys.stdout.write("Please respond with %s or %s" % (', '.join([o for o in yes_options if not o == '']) , ', '.join([o for o in no_options if not o == '']))) diff --git a/requirements_to_watch.txt b/requirements_to_watch.txt index 4440448d..91f0041b 100644 --- a/requirements_to_watch.txt +++ b/requirements_to_watch.txt @@ -1,4 +1,2 @@ -# These requirements prevented an upgrade to Django 1.10. -django-coverage-plugin==1.5.0 +# These requirements prevented an upgrade to Django 1.11. django-autoslug==1.9.3 - diff --git a/setup.py b/setup.py index a300dc7f..29db1f6d 100644 --- a/setup.py +++ b/setup.py @@ -34,14 +34,13 @@ setup( classifiers=[ 'Development Status :: 4 - Beta', 'Environment :: Console', - 'Framework :: Django :: 1.10', + 'Framework :: Django :: 1.11', 'Intended Audience :: Developers', 'Natural Language :: English', 'License :: OSI Approved :: BSD License', 'Programming Language :: Python', 'Programming Language :: Python :: 3', - 'Programming Language :: Python :: 3.4', - 'Programming Language :: Python :: 3.5', + 'Programming Language :: Python :: 3.6', 'Programming Language :: Python :: Implementation :: CPython', 'Programming Language :: Python :: Implementation :: PyPy', 'Topic :: Software Development', diff --git a/{{cookiecutter.project_slug}}/.travis.yml b/{{cookiecutter.project_slug}}/.travis.yml index 216b8709..5ca54d00 100644 --- a/{{cookiecutter.project_slug}}/.travis.yml +++ b/{{cookiecutter.project_slug}}/.travis.yml @@ -8,4 +8,4 @@ before_install: - sudo apt-get install -qq libsqlite3-dev libxml2 libxml2-dev libssl-dev libbz2-dev wget curl llvm language: python python: - - "3.5" + - "3.6" diff --git a/{{cookiecutter.project_slug}}/compose/local/django/Dockerfile b/{{cookiecutter.project_slug}}/compose/local/django/Dockerfile index e62b524a..b9ee34b7 100644 --- a/{{cookiecutter.project_slug}}/compose/local/django/Dockerfile +++ b/{{cookiecutter.project_slug}}/compose/local/django/Dockerfile @@ -1,4 +1,4 @@ -FROM python:3.5 +FROM python:3.6 ENV PYTHONUNBUFFERED 1 diff --git a/{{cookiecutter.project_slug}}/compose/production/django/Dockerfile b/{{cookiecutter.project_slug}}/compose/production/django/Dockerfile index fcbe5184..48923c80 100644 --- a/{{cookiecutter.project_slug}}/compose/production/django/Dockerfile +++ b/{{cookiecutter.project_slug}}/compose/production/django/Dockerfile @@ -1,4 +1,4 @@ -FROM python:3.5 +FROM python:3.6 ENV PYTHONUNBUFFERED 1 diff --git a/{{cookiecutter.project_slug}}/docs/docker_ec2.rst b/{{cookiecutter.project_slug}}/docs/docker_ec2.rst index 3e43ed76..606d2956 100644 --- a/{{cookiecutter.project_slug}}/docs/docker_ec2.rst +++ b/{{cookiecutter.project_slug}}/docs/docker_ec2.rst @@ -58,7 +58,7 @@ The `Docker compose documentation`_ explains in detail what you can accomplish i build: database webapp: build: webapp: - command: /usr/bin/python3.4 manage.py runserver 0.0.0.0:8000 # dev setting + command: /usr/bin/python3.6 manage.py runserver 0.0.0.0:8000 # dev setting # command: gunicorn -b 0.0.0.0:8000 wsgi:application # production setting volumes: - webapp/your_project_name:/path/to/container/workdir/ diff --git a/{{cookiecutter.project_slug}}/runtime.txt b/{{cookiecutter.project_slug}}/runtime.txt index cfa5aa5c..02d0df5e 100644 --- a/{{cookiecutter.project_slug}}/runtime.txt +++ b/{{cookiecutter.project_slug}}/runtime.txt @@ -1 +1 @@ -python-3.6.2 +python-3.6.3 diff --git a/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/users/models.py b/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/users/models.py index c06f15da..9a831b48 100644 --- a/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/users/models.py +++ b/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/users/models.py @@ -1,6 +1,6 @@ from django.contrib.auth.models import AbstractUser -from django.core.urlresolvers import reverse from django.db import models +from django.urls import reverse from django.utils.encoding import python_2_unicode_compatible from django.utils.translation import ugettext_lazy as _ diff --git a/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/users/tests/test_urls.py b/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/users/tests/test_urls.py index 6e181cc8..4935b0f3 100644 --- a/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/users/tests/test_urls.py +++ b/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/users/tests/test_urls.py @@ -1,4 +1,4 @@ -from django.core.urlresolvers import reverse, resolve +from django.urls import reverse, resolve from test_plus.test import TestCase diff --git a/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/users/views.py b/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/users/views.py index 777f42b7..acde4a8f 100644 --- a/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/users/views.py +++ b/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/users/views.py @@ -1,7 +1,6 @@ -from django.core.urlresolvers import reverse -from django.views.generic import DetailView, ListView, RedirectView, UpdateView - from django.contrib.auth.mixins import LoginRequiredMixin +from django.urls import reverse +from django.views.generic import DetailView, ListView, RedirectView, UpdateView from .models import User From f7bd7a581427fe7b02b595f79464292447ba6478 Mon Sep 17 00:00:00 2001 From: Reggie Riser Date: Thu, 28 Dec 2017 15:52:22 -0500 Subject: [PATCH 02/41] Fixing leftovers from migration to Django 1.11 and Python 3.6. --- CONTRIBUTING.rst | 4 ++-- docs/deployment-on-pythonanywhere.rst | 2 +- docs/deployment-with-elastic-beanstalk.rst | 2 +- hooks/pre_gen_project.py | 4 ++-- requirements_to_watch.txt | 4 +--- setup.py | 5 ++--- {{cookiecutter.project_slug}}/.travis.yml | 2 +- .../compose/local/django/Dockerfile | 2 +- .../compose/production/django/Dockerfile | 2 +- {{cookiecutter.project_slug}}/docs/docker_ec2.rst | 2 +- {{cookiecutter.project_slug}}/runtime.txt | 2 +- .../{{cookiecutter.project_slug}}/users/models.py | 2 +- .../{{cookiecutter.project_slug}}/users/tests/test_urls.py | 2 +- .../{{cookiecutter.project_slug}}/users/views.py | 5 ++--- 14 files changed, 18 insertions(+), 22 deletions(-) diff --git a/CONTRIBUTING.rst b/CONTRIBUTING.rst index efff1fad..0e4e258c 100644 --- a/CONTRIBUTING.rst +++ b/CONTRIBUTING.rst @@ -39,9 +39,9 @@ To run all tests using various versions of python in virtualenvs defined in tox. It is possible to tests with some versions of python, to do this the command is:: - $ tox -e py34,py35 + $ tox -e py35,py36 -Will run py.test with the python3.4, and python3.5 interpreters, for +Will run py.test with the python3.5, and python3.6 interpreters, for example. To run a particular test with tox for against your current Python version:: diff --git a/docs/deployment-on-pythonanywhere.rst b/docs/deployment-on-pythonanywhere.rst index 07b46bc0..d70684bd 100644 --- a/docs/deployment-on-pythonanywhere.rst +++ b/docs/deployment-on-pythonanywhere.rst @@ -35,7 +35,7 @@ Make sure your project is fully commited and pushed up to Bitbucket or Github or git clone # you can also use hg cd my-project-name - mkvirtualenv --python=/usr/bin/python3.5 my-project-name + mkvirtualenv --python=/usr/bin/python3.6 my-project-name pip install -r requirements/production.txt # may take a few minutes diff --git a/docs/deployment-with-elastic-beanstalk.rst b/docs/deployment-with-elastic-beanstalk.rst index e8aae885..5edf1795 100644 --- a/docs/deployment-with-elastic-beanstalk.rst +++ b/docs/deployment-with-elastic-beanstalk.rst @@ -20,7 +20,7 @@ Instructions If you haven't done so, create a directory of environments:: - eb init -p python3.4 MY_PROJECT_SLUG + eb init -p python3.6 MY_PROJECT_SLUG Replace `MY_PROJECT_SLUG` with the value you entered for `project_slug`. diff --git a/hooks/pre_gen_project.py b/hooks/pre_gen_project.py index c7a68450..d509a464 100644 --- a/hooks/pre_gen_project.py +++ b/hooks/pre_gen_project.py @@ -16,7 +16,7 @@ if docker == 'n': python_major_version = sys.version_info[0] if python_major_version == 2: - sys.stdout.write("WARNING: Cookiecutter Django does not support Python 2! Stability is guaranteed with Python 3.4+ only. Are you sure you want to proceed? (y/n)") + sys.stdout.write("WARNING: Cookiecutter Django does not support Python 2! Stability is guaranteed with Python 3.6+ only. Are you sure you want to proceed? (y/n)") yes_options = set(['y']) no_options = set(['n', '']) @@ -26,6 +26,6 @@ if docker == 'n': elif choice in yes_options: pass else: - sys.stdout.write("Please respond with %s or %s" + sys.stdout.write("Please respond with %s or %s" % (', '.join([o for o in yes_options if not o == '']) , ', '.join([o for o in no_options if not o == '']))) diff --git a/requirements_to_watch.txt b/requirements_to_watch.txt index 4440448d..91f0041b 100644 --- a/requirements_to_watch.txt +++ b/requirements_to_watch.txt @@ -1,4 +1,2 @@ -# These requirements prevented an upgrade to Django 1.10. -django-coverage-plugin==1.5.0 +# These requirements prevented an upgrade to Django 1.11. django-autoslug==1.9.3 - diff --git a/setup.py b/setup.py index a300dc7f..29db1f6d 100644 --- a/setup.py +++ b/setup.py @@ -34,14 +34,13 @@ setup( classifiers=[ 'Development Status :: 4 - Beta', 'Environment :: Console', - 'Framework :: Django :: 1.10', + 'Framework :: Django :: 1.11', 'Intended Audience :: Developers', 'Natural Language :: English', 'License :: OSI Approved :: BSD License', 'Programming Language :: Python', 'Programming Language :: Python :: 3', - 'Programming Language :: Python :: 3.4', - 'Programming Language :: Python :: 3.5', + 'Programming Language :: Python :: 3.6', 'Programming Language :: Python :: Implementation :: CPython', 'Programming Language :: Python :: Implementation :: PyPy', 'Topic :: Software Development', diff --git a/{{cookiecutter.project_slug}}/.travis.yml b/{{cookiecutter.project_slug}}/.travis.yml index 216b8709..5ca54d00 100644 --- a/{{cookiecutter.project_slug}}/.travis.yml +++ b/{{cookiecutter.project_slug}}/.travis.yml @@ -8,4 +8,4 @@ before_install: - sudo apt-get install -qq libsqlite3-dev libxml2 libxml2-dev libssl-dev libbz2-dev wget curl llvm language: python python: - - "3.5" + - "3.6" diff --git a/{{cookiecutter.project_slug}}/compose/local/django/Dockerfile b/{{cookiecutter.project_slug}}/compose/local/django/Dockerfile index e62b524a..b9ee34b7 100644 --- a/{{cookiecutter.project_slug}}/compose/local/django/Dockerfile +++ b/{{cookiecutter.project_slug}}/compose/local/django/Dockerfile @@ -1,4 +1,4 @@ -FROM python:3.5 +FROM python:3.6 ENV PYTHONUNBUFFERED 1 diff --git a/{{cookiecutter.project_slug}}/compose/production/django/Dockerfile b/{{cookiecutter.project_slug}}/compose/production/django/Dockerfile index fcbe5184..48923c80 100644 --- a/{{cookiecutter.project_slug}}/compose/production/django/Dockerfile +++ b/{{cookiecutter.project_slug}}/compose/production/django/Dockerfile @@ -1,4 +1,4 @@ -FROM python:3.5 +FROM python:3.6 ENV PYTHONUNBUFFERED 1 diff --git a/{{cookiecutter.project_slug}}/docs/docker_ec2.rst b/{{cookiecutter.project_slug}}/docs/docker_ec2.rst index 3e43ed76..606d2956 100644 --- a/{{cookiecutter.project_slug}}/docs/docker_ec2.rst +++ b/{{cookiecutter.project_slug}}/docs/docker_ec2.rst @@ -58,7 +58,7 @@ The `Docker compose documentation`_ explains in detail what you can accomplish i build: database webapp: build: webapp: - command: /usr/bin/python3.4 manage.py runserver 0.0.0.0:8000 # dev setting + command: /usr/bin/python3.6 manage.py runserver 0.0.0.0:8000 # dev setting # command: gunicorn -b 0.0.0.0:8000 wsgi:application # production setting volumes: - webapp/your_project_name:/path/to/container/workdir/ diff --git a/{{cookiecutter.project_slug}}/runtime.txt b/{{cookiecutter.project_slug}}/runtime.txt index cfa5aa5c..02d0df5e 100644 --- a/{{cookiecutter.project_slug}}/runtime.txt +++ b/{{cookiecutter.project_slug}}/runtime.txt @@ -1 +1 @@ -python-3.6.2 +python-3.6.3 diff --git a/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/users/models.py b/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/users/models.py index c06f15da..9a831b48 100644 --- a/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/users/models.py +++ b/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/users/models.py @@ -1,6 +1,6 @@ from django.contrib.auth.models import AbstractUser -from django.core.urlresolvers import reverse from django.db import models +from django.urls import reverse from django.utils.encoding import python_2_unicode_compatible from django.utils.translation import ugettext_lazy as _ diff --git a/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/users/tests/test_urls.py b/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/users/tests/test_urls.py index 6e181cc8..4935b0f3 100644 --- a/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/users/tests/test_urls.py +++ b/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/users/tests/test_urls.py @@ -1,4 +1,4 @@ -from django.core.urlresolvers import reverse, resolve +from django.urls import reverse, resolve from test_plus.test import TestCase diff --git a/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/users/views.py b/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/users/views.py index 777f42b7..acde4a8f 100644 --- a/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/users/views.py +++ b/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/users/views.py @@ -1,7 +1,6 @@ -from django.core.urlresolvers import reverse -from django.views.generic import DetailView, ListView, RedirectView, UpdateView - from django.contrib.auth.mixins import LoginRequiredMixin +from django.urls import reverse +from django.views.generic import DetailView, ListView, RedirectView, UpdateView from .models import User From 3e19f564d39f640f46faa445675230eae786eaba Mon Sep 17 00:00:00 2001 From: Reggie Riser Date: Wed, 3 Jan 2018 08:53:17 -0500 Subject: [PATCH 03/41] Removed py35 reference from tox instructions. --- CONTRIBUTING.rst | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/CONTRIBUTING.rst b/CONTRIBUTING.rst index 0e4e258c..cfe16740 100644 --- a/CONTRIBUTING.rst +++ b/CONTRIBUTING.rst @@ -36,13 +36,12 @@ To run all tests using various versions of python in virtualenvs defined in tox. $ tox -It is possible to tests with some versions of python, to do this the command +It is possible to test with a specific version of python. To do this, the command is:: - $ tox -e py35,py36 + $ tox -e py36 -Will run py.test with the python3.5, and python3.6 interpreters, for -example. +This will run py.test with the python3.6 interpreter, for example. To run a particular test with tox for against your current Python version:: From b2025a8f72506d192edd408549bba54a84667f2f Mon Sep 17 00:00:00 2001 From: "pyup.io bot" Date: Sat, 13 Jan 2018 23:12:13 +0100 Subject: [PATCH 04/41] Update boto3 from 1.5.12 to 1.5.14 (#1447) --- {{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 5042686b..79a0cf2b 100644 --- a/{{cookiecutter.project_slug}}/requirements/production.txt +++ b/{{cookiecutter.project_slug}}/requirements/production.txt @@ -16,7 +16,7 @@ gunicorn==19.7.1 # Static and Media Storage # ------------------------------------------------ -boto3==1.5.12 +boto3==1.5.14 django-storages==1.6.5 {% if cookiecutter.use_whitenoise != 'y' -%} Collectfast==0.6.0 From 789bd97effab8fe9c6696e1dae9e24e538e4c317 Mon Sep 17 00:00:00 2001 From: "pyup.io bot" Date: Sun, 14 Jan 2018 16:56:58 +0100 Subject: [PATCH 05/41] Update django-extensions from 1.9.8 to 1.9.9 (#1443) --- {{cookiecutter.project_slug}}/requirements/local.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/{{cookiecutter.project_slug}}/requirements/local.txt b/{{cookiecutter.project_slug}}/requirements/local.txt index 0d42646d..2622b778 100644 --- a/{{cookiecutter.project_slug}}/requirements/local.txt +++ b/{{cookiecutter.project_slug}}/requirements/local.txt @@ -5,7 +5,7 @@ coverage==4.4.2 django-coverage-plugin==1.5.0 Sphinx==1.6.6 -django-extensions==1.9.8 +django-extensions==1.9.9 Werkzeug==0.14.1 django-test-plus==1.0.22 factory-boy==2.9.2 From 793a46ba45229cf26c67d760c4b1df767a9e0f12 Mon Sep 17 00:00:00 2001 From: Daniel Roy Greenfeld Date: Mon, 15 Jan 2018 12:33:51 -0800 Subject: [PATCH 06/41] Removed expiramental elastic beanstalk support and bumped official Django version to 1.11.9 --- CHANGELOG.md | 4 + LICENSE | 2 +- README.rst | 2 - cookiecutter.json | 1 - docs/deployment-with-elastic-beanstalk.rst | 75 ----------------- docs/index.rst | 1 - hooks/post_gen_project.py | 80 +++++++++---------- hooks/pre_gen_project.py | 6 +- setup.py | 2 +- .../.ebextensions/10_packages.config | 7 -- .../.ebextensions/20_elasticcache.config | 46 ----------- .../.ebextensions/30_options.config | 6 -- .../.ebextensions/40_python.config | 17 ---- .../.ebextensions/50_apache.config | 3 - .../.ebextensions/enable_mod_deflate.conf | 25 ------ {{cookiecutter.project_slug}}/README.rst | 9 --- .../config/settings/production.py | 25 +----- {{cookiecutter.project_slug}}/ebsetenv.py | 37 --------- 18 files changed, 46 insertions(+), 302 deletions(-) delete mode 100644 docs/deployment-with-elastic-beanstalk.rst delete mode 100644 {{cookiecutter.project_slug}}/.ebextensions/10_packages.config delete mode 100644 {{cookiecutter.project_slug}}/.ebextensions/20_elasticcache.config delete mode 100644 {{cookiecutter.project_slug}}/.ebextensions/30_options.config delete mode 100644 {{cookiecutter.project_slug}}/.ebextensions/40_python.config delete mode 100644 {{cookiecutter.project_slug}}/.ebextensions/50_apache.config delete mode 100644 {{cookiecutter.project_slug}}/.ebextensions/enable_mod_deflate.conf delete mode 100644 {{cookiecutter.project_slug}}/ebsetenv.py diff --git a/CHANGELOG.md b/CHANGELOG.md index c40bb26b..24f8d11c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,10 @@ All enhancements and patches to Cookiecutter Django will be documented in this file. This project adheres to [Semantic Versioning](http://semver.org/). +## [2018-01-15] +### Changed +- Removed Elastic Beanstalk support (@pydanny) + ## [2017-12-28] ### Changed - Upgraded to Django 1.11 (@pydanny) diff --git a/LICENSE b/LICENSE index 9a5d2fc0..da2bbe30 100644 --- a/LICENSE +++ b/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2013-2016, Daniel Greenfeld +Copyright (c) 2013-2018, Daniel Greenfeld All rights reserved. Redistribution and use in source and binary forms, with or without modification, diff --git a/README.rst b/README.rst index 838253f4..35a8bc42 100644 --- a/README.rst +++ b/README.rst @@ -51,7 +51,6 @@ Features * Instructions for deploying to PythonAnywhere_ * Run tests with unittest or py.test * Customizable PostgreSQL version -* Experimental support for Amazon Elastic Beanstalk .. _`maintained Foundation fork`: https://github.com/Parbhat/cookiecutter-django-foundation @@ -185,7 +184,6 @@ Answer the prompts with your own desired options_. For example:: 4 - Apache Software License 2.0 5 - Not open source Choose from 1, 2, 3, 4, 5 [1]: 1 - use_elasticbeanstalk_experimental: n Enter the project and take a look around:: diff --git a/cookiecutter.json b/cookiecutter.json index 184e8796..933c3dfa 100644 --- a/cookiecutter.json +++ b/cookiecutter.json @@ -16,7 +16,6 @@ "windows": "n", "use_docker": "n", "use_heroku": "n", - "use_elasticbeanstalk_experimental": "n", "use_compressor": "n", "postgresql_version": ["10", "9.6", "9.5", "9.4", "9.3", "9.2"], "js_task_runner": ["Gulp", "Grunt", "None"], diff --git a/docs/deployment-with-elastic-beanstalk.rst b/docs/deployment-with-elastic-beanstalk.rst deleted file mode 100644 index d481c93b..00000000 --- a/docs/deployment-with-elastic-beanstalk.rst +++ /dev/null @@ -1,75 +0,0 @@ -Deployment with Elastic Beanstalk -========================================== - -.. index:: Elastic Beanstalk - -Warning: Experimental ---------------------- - -This is experimental. For the time being there will be bugs and issues. If you've never used Elastic Beanstalk before, please hold off before trying this option. - -On the other hand, we need help cleaning this up. If you do have knowledge of Elastic Beanstalk, we would appreciate the help. :) - -Prerequisites -------------- - -* awsebcli - -Instructions -------------- - -If you haven't done so, create a directory of environments:: - - eb init -p python3.4 MY_PROJECT_SLUG - # Warning: If you use python3.6, you will run into problems later due to some incompatibility with - # mod_wgsi 3.5 (packaged in 64bit Amazon Linux 2017.09 v2.6.1 running Python 3.6). See: - # https://serverfault.com/questions/884469/mod-wsgi-call-to-site-addsitedir-failed-on-aws-elastic-beanstalk-python-3/885445 - -Replace `MY_PROJECT_SLUG` with the value you entered for `project_slug`. - -Once that is done, create the environment (server) where the app will run:: - - eb create MY_PROJECT_SLUG - # Note: This will eventually fail on a postgres error, because postgres doesn't exist yet - -Now make sure you are in the right environment:: - - eb list - -If you are not in the right environment, then put yourself in the correct one:: - - eb use MY_PROJECT_SLUG - -Set the environment variables. Notes: You will be prompted if the `.env` file is missing. The script will ignore any PostgreSQL values, as RDS uses it's own system:: - - # Set the environment variables - python ebsetenv.py - -Speaking of PostgreSQL, go to the Elasting Beanstalk configuration panel for RDS. Create new RDS database, with these attributes: - -* PostgreSQL -* Version 9.4.9 -* Size db.t2.micro (You can upgrade later) - -(Get some coffee, this is going to take a while) - -Once you have a database specified, deploy again so your instance can pick up the new PostgreSQL values:: - - eb deploy - -Take a look:: - - eb open - -FAQ ------ - -Why Not Use Docker on Elastic Beanstalk? -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -Because I didn't want to add an abstraction (Docker) on top of an abstraction (Elastic Beanstalk) on top of an abstraction (Cookiecutter Django). - -Why Can't I Use Both Docker/Heroku with Elastic Beanstalk? -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -Because the environment variables that our Docker and Heroku setups use for PostgreSQL access is different then how Amazon RDS handles this access. At this time we're just trying to get things to work reliably with Elastic Beanstalk, and full integration will come later. diff --git a/docs/index.rst b/docs/index.rst index 3b0a268c..41a1138f 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -25,7 +25,6 @@ Contents: faq troubleshooting my-favorite-cookie - deployment-with-elastic-beanstalk Indices and tables ================== diff --git a/hooks/post_gen_project.py b/hooks/post_gen_project.py index b383e419..6a9df04f 100644 --- a/hooks/post_gen_project.py +++ b/hooks/post_gen_project.py @@ -12,6 +12,7 @@ A portion of this code was adopted from Django's standard crypto functions and utilities, specifically: https://github.com/django/django/blob/master/django/utils/crypto.py """ +from __future__ import print_function import os import random import shutil @@ -119,8 +120,6 @@ def remove_heroku_files(): Removes files needed for heroku if it isn't going to be used """ filenames = ["Procfile", "runtime.txt"] - if '{{ cookiecutter.use_elasticbeanstalk_experimental }}'.lower() != 'y': - filenames.append("requirements.txt") for filename in ["Procfile", "runtime.txt"]: file_name = os.path.join(PROJECT_DIRECTORY, filename) remove_file(file_name) @@ -130,7 +129,7 @@ def remove_docker_files(): """ Removes files needed for docker if it isn't going to be used """ - for filename in ["local.yml", "production.yml", ".dockerignore"]: + for filename in ["dev.yml", "docker-compose.yml", ".dockerignore"]: os.remove(os.path.join( PROJECT_DIRECTORY, filename )) @@ -167,6 +166,14 @@ def remove_packageJSON_file(): PROJECT_DIRECTORY, filename )) +def remove_certbot_files(): + """ + Removes files needed for certbot if it isn't going to be used + """ + nginx_dir_location = os.path.join(PROJECT_DIRECTORY, 'compose/nginx') + for filename in ["nginx-secure.conf", "start.sh", "dhparams.example.pem"]: + file_name = os.path.join(nginx_dir_location, filename) + remove_file(file_name) def remove_copying_files(): """ @@ -177,31 +184,6 @@ def remove_copying_files(): PROJECT_DIRECTORY, filename )) -def remove_elasticbeanstalk(): - """ - Removes elastic beanstalk components - """ - docs_dir_location = os.path.join(PROJECT_DIRECTORY, '.ebextensions') - if os.path.exists(docs_dir_location): - shutil.rmtree(docs_dir_location) - - filenames = ["ebsetenv.py", ] - if '{{ cookiecutter.use_heroku }}'.lower() != 'y': - filenames.append("requirements.txt") - for filename in filenames: - os.remove(os.path.join( - PROJECT_DIRECTORY, filename - )) - -def remove_open_source_files(): - """ - Removes files conventional to opensource projects only. - """ - for filename in ["CONTRIBUTORS.txt"]: - os.remove(os.path.join( - PROJECT_DIRECTORY, filename - )) - # IN PROGRESS # def copy_doc_files(project_directory): @@ -221,26 +203,26 @@ def remove_open_source_files(): # dst = os.path.join(target_dir, name) # shutil.copyfile(src, dst) -# Generates and saves random secret key +# 1. Generates and saves random secret key make_secret_key(PROJECT_DIRECTORY) -# Removes the taskapp if celery isn't going to be used +# 2. Removes the taskapp if celery isn't going to be used if '{{ cookiecutter.use_celery }}'.lower() == 'n': remove_task_app(PROJECT_DIRECTORY) -# Removes the .idea directory if PyCharm isn't going to be used +# 3. Removes the .idea directory if PyCharm isn't going to be used if '{{ cookiecutter.use_pycharm }}'.lower() != 'y': remove_pycharm_dir(PROJECT_DIRECTORY) -# Removes all heroku files if it isn't going to be used +# 4. Removes all heroku files if it isn't going to be used if '{{ cookiecutter.use_heroku }}'.lower() != 'y': remove_heroku_files() -# Removes all docker files if it isn't going to be used +# 5. Removes all docker files if it isn't going to be used if '{{ cookiecutter.use_docker }}'.lower() != 'y': remove_docker_files() -# Removes all JS task manager files if it isn't going to be used +# 6. Removes all JS task manager files if it isn't going to be used if '{{ cookiecutter.js_task_runner}}'.lower() == 'gulp': remove_grunt_files() elif '{{ cookiecutter.js_task_runner}}'.lower() == 'grunt': @@ -250,7 +232,11 @@ else: remove_grunt_files() remove_packageJSON_file() -# Display a warning if use_docker and use_grunt are selected. Grunt isn't +# 7. Removes all certbot/letsencrypt files if it isn't going to be used +if '{{ cookiecutter.use_lets_encrypt }}'.lower() != 'y': + remove_certbot_files() + +# 8. Display a warning if use_docker and use_grunt are selected. Grunt isn't # supported by our docker config atm. if '{{ cookiecutter.js_task_runner }}'.lower() in ['grunt', 'gulp'] and '{{ cookiecutter.use_docker }}'.lower() == 'y': print( @@ -259,15 +245,21 @@ if '{{ cookiecutter.js_task_runner }}'.lower() in ['grunt', 'gulp'] and '{{ cook "js task runner service to your docker configuration manually." ) +# 9. Removes the certbot/letsencrypt files and display a warning if use_lets_encrypt is selected and use_docker isn't. +if '{{ cookiecutter.use_lets_encrypt }}'.lower() == 'y' and '{{ cookiecutter.use_docker }}'.lower() != 'y': + remove_certbot_files() + print( + "You selected to use Let's Encrypt and didn't select to use docker. This is NOT supported out of the box for now. You " + "can continue to use the project like you normally would, but Let's Encrypt files have been included." + ) -# Removes files needed for the GPLv3 licence if it isn't going to be used. +# 10. Directs the user to the documentation if certbot and docker are selected. +if '{{ cookiecutter.use_lets_encrypt }}'.lower() == 'y' and '{{ cookiecutter.use_docker }}'.lower() == 'y': + print( + "You selected to use Let's Encrypt, please see the documentation for instructions on how to use this in production. " + "You must generate a dhparams.pem file before running docker-compose in a production environment." + ) + +# 11. Removes files needed for the GPLv3 licence if it isn't going to be used. if '{{ cookiecutter.open_source_license}}' != 'GPLv3': remove_copying_files() - -# Remove Elastic Beanstalk files -if '{{ cookiecutter.use_elasticbeanstalk_experimental }}'.lower() != 'y': - remove_elasticbeanstalk() - -# Remove files conventional to opensource projects only. -if '{{ cookiecutter.open_source_license }}' == 'Not open source': - remove_open_source_files() diff --git a/hooks/pre_gen_project.py b/hooks/pre_gen_project.py index c7a68450..5f2c9d5d 100644 --- a/hooks/pre_gen_project.py +++ b/hooks/pre_gen_project.py @@ -3,13 +3,9 @@ project_slug = '{{ cookiecutter.project_slug }}' if hasattr(project_slug, 'isidentifier'): assert project_slug.isidentifier(), 'Project slug should be valid Python identifier!' -elasticbeanstalk = '{{ cookiecutter.use_elasticbeanstalk_experimental }}'.lower() heroku = '{{ cookiecutter.use_heroku }}'.lower() docker = '{{ cookiecutter.use_docker }}'.lower() -if elasticbeanstalk == 'y' and (heroku == 'y' or docker == 'y'): - raise Exception("Cookiecutter Django's EXPERIMENTAL Elastic Beanstalk support is incompatible with Heroku and Docker setups.") - if docker == 'n': import sys @@ -26,6 +22,6 @@ if docker == 'n': elif choice in yes_options: pass else: - sys.stdout.write("Please respond with %s or %s" + sys.stdout.write("Please respond with %s or %s" % (', '.join([o for o in yes_options if not o == '']) , ', '.join([o for o in no_options if not o == '']))) diff --git a/setup.py b/setup.py index a300dc7f..eb5856e6 100644 --- a/setup.py +++ b/setup.py @@ -10,7 +10,7 @@ except ImportError: # 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. -version = '1.11.8' +version = '1.11.9' if sys.argv[-1] == 'tag': os.system('git tag -a %s -m "version %s"' % (version, version)) diff --git a/{{cookiecutter.project_slug}}/.ebextensions/10_packages.config b/{{cookiecutter.project_slug}}/.ebextensions/10_packages.config deleted file mode 100644 index 136be533..00000000 --- a/{{cookiecutter.project_slug}}/.ebextensions/10_packages.config +++ /dev/null @@ -1,7 +0,0 @@ -packages: - yum: - git: [] - postgresql94-devel: [] - libjpeg-turbo-devel: [] - libffi: [] - libffi-devel: [] diff --git a/{{cookiecutter.project_slug}}/.ebextensions/20_elasticcache.config b/{{cookiecutter.project_slug}}/.ebextensions/20_elasticcache.config deleted file mode 100644 index 26c059e3..00000000 --- a/{{cookiecutter.project_slug}}/.ebextensions/20_elasticcache.config +++ /dev/null @@ -1,46 +0,0 @@ -#This sample requires you to create a separate configuration file that defines the custom -# option settings for CacheCluster properties. - -Resources: - MyCacheSecurityGroup: - Type: "AWS::EC2::SecurityGroup" - Properties: - GroupDescription: "Lock cache down to webserver access only" - SecurityGroupIngress : - - IpProtocol : "tcp" - FromPort : - Fn::GetOptionSetting: - OptionName : "CachePort" - DefaultValue: "6379" - ToPort : - Fn::GetOptionSetting: - OptionName : "CachePort" - DefaultValue: "6379" - SourceSecurityGroupName: - Ref: "AWSEBSecurityGroup" - MyElastiCache: - Type: "AWS::ElastiCache::CacheCluster" - Properties: - CacheNodeType: - Fn::GetOptionSetting: - OptionName : "CacheNodeType" - DefaultValue : "cache.t2.micro" - NumCacheNodes: - Fn::GetOptionSetting: - OptionName : "NumCacheNodes" - DefaultValue : "1" - Engine: - Fn::GetOptionSetting: - OptionName : "Engine" - DefaultValue : "redis" - VpcSecurityGroupIds: - - - Fn::GetAtt: - - MyCacheSecurityGroup - - GroupId - -Outputs: - ElastiCache: - Description : "ID of ElastiCache Cache Cluster with Redis Engine" - Value : - Ref : "MyElastiCache" diff --git a/{{cookiecutter.project_slug}}/.ebextensions/30_options.config b/{{cookiecutter.project_slug}}/.ebextensions/30_options.config deleted file mode 100644 index fefec489..00000000 --- a/{{cookiecutter.project_slug}}/.ebextensions/30_options.config +++ /dev/null @@ -1,6 +0,0 @@ -option_settings: - "aws:elasticbeanstalk:customoption": - CacheNodeType : cache.t2.micro - NumCacheNodes : 1 - Engine : redis - CachePort : 6379 diff --git a/{{cookiecutter.project_slug}}/.ebextensions/40_python.config b/{{cookiecutter.project_slug}}/.ebextensions/40_python.config deleted file mode 100644 index 03b91eb4..00000000 --- a/{{cookiecutter.project_slug}}/.ebextensions/40_python.config +++ /dev/null @@ -1,17 +0,0 @@ -container_commands: - 01_migrate: - command: "source /opt/python/run/venv/bin/activate && python manage.py migrate --noinput" - leader_only: True - 02_collectstatic: - command: "source /opt/python/run/venv/bin/activate && python manage.py collectstatic --noinput" -option_settings: - "aws:elasticbeanstalk:application:environment": - DJANGO_SETTINGS_MODULE: "config.settings.production" - REDIS_ENDPOINT_ADDRESS: '`{ "Fn::GetAtt" : [ "MyElastiCache", "RedisEndpoint.Address"]}`' - REDIS_PORT: '`{ "Fn::GetAtt" : [ "MyElastiCache", "RedisEndpoint.Port"]}`' - "aws:elasticbeanstalk:container:python": - WSGIPath: config/wsgi.py - NumProcesses: 3 - NumThreads: 20 - "aws:elasticbeanstalk:container:python:staticfiles": - "/static/": "www/static/" diff --git a/{{cookiecutter.project_slug}}/.ebextensions/50_apache.config b/{{cookiecutter.project_slug}}/.ebextensions/50_apache.config deleted file mode 100644 index 672cb625..00000000 --- a/{{cookiecutter.project_slug}}/.ebextensions/50_apache.config +++ /dev/null @@ -1,3 +0,0 @@ -container_commands: - 01_setup_apache: - command: "cp .ebextensions/enable_mod_deflate.conf /etc/httpd/conf.d/enable_mod_deflate.conf" diff --git a/{{cookiecutter.project_slug}}/.ebextensions/enable_mod_deflate.conf b/{{cookiecutter.project_slug}}/.ebextensions/enable_mod_deflate.conf deleted file mode 100644 index 7a77cc23..00000000 --- a/{{cookiecutter.project_slug}}/.ebextensions/enable_mod_deflate.conf +++ /dev/null @@ -1,25 +0,0 @@ -# mod_deflate configuration - - # Restrict compression to these MIME types - AddOutputFilterByType DEFLATE text/plain - AddOutputFilterByType DEFLATE text/html - AddOutputFilterByType DEFLATE application/xhtml+xml - AddOutputFilterByType DEFLATE text/xml - AddOutputFilterByType DEFLATE application/xml - AddOutputFilterByType DEFLATE application/xml+rss - AddOutputFilterByType DEFLATE application/x-javascript - AddOutputFilterByType DEFLATE text/javascript - AddOutputFilterByType DEFLATE text/css - # Level of compression (Highest 9 - Lowest 1) - DeflateCompressionLevel 9 - # Netscape 4.x has some problems. - BrowserMatch ^Mozilla/4 gzip-only-text/html - # Netscape 4.06-4.08 have some more problems - BrowserMatch ^Mozilla/4\.0[678] no-gzip - # MSIE masquerades as Netscape, but it is fine - BrowserMatch \bMSI[E] !no-gzip !gzip-only-text/html - - # Make sure proxies don't deliver the wrong content - Header append Vary User-Agent env=!dont-vary - - diff --git a/{{cookiecutter.project_slug}}/README.rst b/{{cookiecutter.project_slug}}/README.rst index c4bf9fe3..06dd82ed 100644 --- a/{{cookiecutter.project_slug}}/README.rst +++ b/{{cookiecutter.project_slug}}/README.rst @@ -132,16 +132,7 @@ See detailed `cookiecutter-django Docker documentation`_. .. _`cookiecutter-django Docker documentation`: http://cookiecutter-django.readthedocs.io/en/latest/deployment-with-docker.html {% endif %} -{% if cookiecutter.use_elasticbeanstalk_experimental.lower() == 'y' %} -Elastic Beanstalk -~~~~~~~~~~~~~~~~~~ - -See detailed `cookiecutter-django Elastic Beanstalk documentation`_. - -.. _`cookiecutter-django Elastic Beanstalk documentation`: http://cookiecutter-django.readthedocs.io/en/latest/deployment-with-elastic-beanstalk.html - -{% endif %} {% if cookiecutter.custom_bootstrap_compilation == "y" %} Custom Bootstrap Compilation ^^^^^^ diff --git a/{{cookiecutter.project_slug}}/config/settings/production.py b/{{cookiecutter.project_slug}}/config/settings/production.py index db581306..33542fbf 100644 --- a/{{cookiecutter.project_slug}}/config/settings/production.py +++ b/{{cookiecutter.project_slug}}/config/settings/production.py @@ -172,36 +172,17 @@ TEMPLATES[0]['OPTIONS']['loaders'] = [ {% set _DEFAULT_CONN_MAX_AGE=60 %} # DATABASE CONFIGURATION # ------------------------------------------------------------------------------ -{% if cookiecutter.use_elasticbeanstalk_experimental.lower() == 'y' -%} -# Uses Amazon RDS for database hosting, which doesn't follow the Heroku-style spec -DATABASES = { - 'default': { - 'ENGINE': 'django.db.backends.postgresql_psycopg2', - 'NAME': env('RDS_DB_NAME'), - 'USER': env('RDS_USERNAME'), - 'PASSWORD': env('RDS_PASSWORD'), - 'HOST': env('RDS_HOSTNAME'), - 'PORT': env('RDS_PORT'), - 'CONN_MAX_AGE': env.int('CONN_MAX_AGE', default={{ _DEFAULT_CONN_MAX_AGE }}), - } -} -{% else %} + # Use the Heroku-style specification # Raises ImproperlyConfigured exception if DATABASE_URL not in os.environ DATABASES['default'] = env.db('DATABASE_URL') DATABASES['default']['CONN_MAX_AGE'] = env.int('CONN_MAX_AGE', default={{ _DEFAULT_CONN_MAX_AGE }}) -{%- endif %} + # CACHING # ------------------------------------------------------------------------------ -{% if cookiecutter.use_elasticbeanstalk_experimental.lower() == 'y' -%} -REDIS_LOCATION = 'redis://{}:{}/0'.format( - env('REDIS_ENDPOINT_ADDRESS'), - env('REDIS_PORT') -) -{% else %} REDIS_LOCATION = '{0}/{1}'.format(env('REDIS_URL', default='redis://127.0.0.1:6379'), 0) -{%- endif %} + # Heroku URL does not pass the DB number, so we parse it in CACHES = { 'default': { diff --git a/{{cookiecutter.project_slug}}/ebsetenv.py b/{{cookiecutter.project_slug}}/ebsetenv.py deleted file mode 100644 index ba9652db..00000000 --- a/{{cookiecutter.project_slug}}/ebsetenv.py +++ /dev/null @@ -1,37 +0,0 @@ -"""Converts a .env file to Elastic Beanstalk environment variables""" - -import os -from sys import exit -from subprocess import check_call - -try: - import dotenv -except ImportError: - print("Please install the 'dotenv' library: 'pip install dotenv'") - exit() - -def main(): - if not os.path.exists('.env'): - print('ERROR!! .env file is missing!') - print("Please copy 'env.example' to '.env' and add appropriate values") - exit() - command = ['eb', 'setenv'] - failures = [] - for key, value in dotenv.Dotenv('.env').items(): - if key.startswith('POSTGRES'): - print('Skipping POSTGRES values - Amazon RDS provides these') - continue - if value: - command.append("{}={}".format(key, value)) - else: - failures.append(key) - if failures: - for failure in failures: - print("{} requires a value".format(failure)) - else: - print(' '.join(command)) - check_call(command) - - -if __name__ == '__main__': - main() From ea8e70a362e56e491639bfc7dab820fc1cd99e2c Mon Sep 17 00:00:00 2001 From: Daniel Roy Greenfeld Date: Mon, 15 Jan 2018 12:43:34 -0800 Subject: [PATCH 07/41] Update the README --- README.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.rst b/README.rst index 35a8bc42..eb6fac6f 100644 --- a/README.rst +++ b/README.rst @@ -220,7 +220,7 @@ Community .. _`issue`: https://github.com/pydanny/cookiecutter-django/issues .. _`Gitter`: https://gitter.im/pydanny/cookiecutter-django?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge -For Readers of Two Scoops of Django 1.8 +For Readers of Two Scoops of Django -------------------------------------------- You may notice that some elements of this project do not exactly match what we describe in chapter 3. The reason for that is this project, amongst other things, serves as a test bed for trying out new ideas and concepts. Sometimes they work, sometimes they don't, but the end result is that it won't necessarily match precisely what is described in the book I co-authored. From 2c0d5cfc9e84bb6238c2c497364f97a2ab52596c Mon Sep 17 00:00:00 2001 From: Audrey Roy Greenfeld Date: Mon, 15 Jan 2018 12:51:24 -0800 Subject: [PATCH 08/41] Updated README --- README.rst | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/README.rst b/README.rst index eb6fac6f..b8ecc035 100644 --- a/README.rst +++ b/README.rst @@ -272,14 +272,21 @@ experience better. Articles --------- +* `Deploying Cookiecutter-Django with Docker-Compose`_ - Oct. 19, 2017 +* `Using Cookiecutter to Jumpstart a Django Project on Windows with PyCharm`_ - May 19, 2017 +* `Exploring with Cookiecutter`_ - Dec. 3, 2016 +* `Introduction to Cookiecutter-Django`_ - Feb. 19, 2016 +* `Django and GitLab - Running Continuous Integration and tests with your FREE account`_ - May. 11, 2016 * `Development and Deployment of Cookiecutter-Django on Fedora`_ - Jan. 18, 2016 * `Development and Deployment of Cookiecutter-Django via Docker`_ - Dec. 29, 2015 * `How to create a Django Application using Cookiecutter and Django 1.8`_ - Sept. 12, 2015 -* `Introduction to Cookiecutter-Django`_ - Feb. 19, 2016 -* `Django and GitLab - Running Continuous Integration and tests with your FREE account`_ - May. 11, 2016 Have a blog or online publication? Write about your cookiecutter-django tips and tricks, then send us a pull request with the link. +.. _`Deploying Cookiecutter-Django with Docker-Compose`: http://adamantine.me/2017/10/19/deploying-cookiecutter-django-with-docker-compose/ +.. _`Exploring with Cookiecutter`: http://www.snowboardingcoder.com/django/2016/12/03/exploring-with-cookiecutter/ +.. _`Using Cookiecutter to Jumpstart a Django Project on Windows with PyCharm`: https://joshuahunter.com/posts/using-cookiecutter-to-jumpstart-a-django-project-on-windows-with-pycharm/ + .. _`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/ .. _`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/ From 1cb960551193e9a09a3c9a93e76b5e3a0d76cd3c Mon Sep 17 00:00:00 2001 From: Audrey Roy Greenfeld Date: Mon, 15 Jan 2018 14:05:27 -0800 Subject: [PATCH 09/41] Remove old lets_encrypt stuff that was breaking tests --- hooks/post_gen_project.py | 31 ++----------------------------- 1 file changed, 2 insertions(+), 29 deletions(-) diff --git a/hooks/post_gen_project.py b/hooks/post_gen_project.py index 6a9df04f..bffa783f 100644 --- a/hooks/post_gen_project.py +++ b/hooks/post_gen_project.py @@ -166,15 +166,6 @@ def remove_packageJSON_file(): PROJECT_DIRECTORY, filename )) -def remove_certbot_files(): - """ - Removes files needed for certbot if it isn't going to be used - """ - nginx_dir_location = os.path.join(PROJECT_DIRECTORY, 'compose/nginx') - for filename in ["nginx-secure.conf", "start.sh", "dhparams.example.pem"]: - file_name = os.path.join(nginx_dir_location, filename) - remove_file(file_name) - def remove_copying_files(): """ Removes files needed for the GPLv3 licence if it isn't going to be used @@ -232,11 +223,8 @@ else: remove_grunt_files() remove_packageJSON_file() -# 7. Removes all certbot/letsencrypt files if it isn't going to be used -if '{{ cookiecutter.use_lets_encrypt }}'.lower() != 'y': - remove_certbot_files() -# 8. Display a warning if use_docker and use_grunt are selected. Grunt isn't +# 9. Display a warning if use_docker and use_grunt are selected. Grunt isn't # supported by our docker config atm. if '{{ cookiecutter.js_task_runner }}'.lower() in ['grunt', 'gulp'] and '{{ cookiecutter.use_docker }}'.lower() == 'y': print( @@ -245,21 +233,6 @@ if '{{ cookiecutter.js_task_runner }}'.lower() in ['grunt', 'gulp'] and '{{ cook "js task runner service to your docker configuration manually." ) -# 9. Removes the certbot/letsencrypt files and display a warning if use_lets_encrypt is selected and use_docker isn't. -if '{{ cookiecutter.use_lets_encrypt }}'.lower() == 'y' and '{{ cookiecutter.use_docker }}'.lower() != 'y': - remove_certbot_files() - print( - "You selected to use Let's Encrypt and didn't select to use docker. This is NOT supported out of the box for now. You " - "can continue to use the project like you normally would, but Let's Encrypt files have been included." - ) - -# 10. Directs the user to the documentation if certbot and docker are selected. -if '{{ cookiecutter.use_lets_encrypt }}'.lower() == 'y' and '{{ cookiecutter.use_docker }}'.lower() == 'y': - print( - "You selected to use Let's Encrypt, please see the documentation for instructions on how to use this in production. " - "You must generate a dhparams.pem file before running docker-compose in a production environment." - ) - -# 11. Removes files needed for the GPLv3 licence if it isn't going to be used. +# 10. Removes files needed for the GPLv3 licence if it isn't going to be used. if '{{ cookiecutter.open_source_license}}' != 'GPLv3': remove_copying_files() From e69ceebfc584373bfec446033dd1de2fa48560fe Mon Sep 17 00:00:00 2001 From: Daniel Roy Greenfeld Date: Tue, 16 Jan 2018 22:06:28 -0800 Subject: [PATCH 10/41] Possible fix for --- hooks/post_gen_project.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/hooks/post_gen_project.py b/hooks/post_gen_project.py index bffa783f..cfe2df12 100644 --- a/hooks/post_gen_project.py +++ b/hooks/post_gen_project.py @@ -130,9 +130,9 @@ def remove_docker_files(): Removes files needed for docker if it isn't going to be used """ for filename in ["dev.yml", "docker-compose.yml", ".dockerignore"]: - os.remove(os.path.join( - PROJECT_DIRECTORY, filename - )) + filename = os.path.join(PROJECT_DIRECTORY, filename) + if os.path.exists(filename): + os.remove(filename) shutil.rmtree(os.path.join( PROJECT_DIRECTORY, "compose" From cc888d89a8326fab44be245397491b667fc81369 Mon Sep 17 00:00:00 2001 From: Reggie Riser Date: Wed, 17 Jan 2018 13:13:09 -0500 Subject: [PATCH 11/41] Fixed old docker-compose filenames (#1457) --- hooks/post_gen_project.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hooks/post_gen_project.py b/hooks/post_gen_project.py index cfe2df12..9a6da7b6 100644 --- a/hooks/post_gen_project.py +++ b/hooks/post_gen_project.py @@ -129,7 +129,7 @@ def remove_docker_files(): """ Removes files needed for docker if it isn't going to be used """ - for filename in ["dev.yml", "docker-compose.yml", ".dockerignore"]: + for filename in ["local.yml", "production.yml", ".dockerignore"]: filename = os.path.join(PROJECT_DIRECTORY, filename) if os.path.exists(filename): os.remove(filename) From af12f39996459dcf9e6ed8bc6d4304a7f932e37a Mon Sep 17 00:00:00 2001 From: Bruno Alla Date: Sun, 21 Jan 2018 01:05:12 +0000 Subject: [PATCH 12/41] Improve custom_bootstrap_compilation option (#1429) * Add Bootstrap to package.json in case of custom_bootstrap_compilation * Update JS task runners and base HTML to handle custom scss compilation * Generate a vendors.js with custom bootstrap compilation + Gulp * Update documentation accordingly * Add missing if/endif in gulpfile * Update to Bootstrap v4 final --- docs/project-generation-options.rst | 4 +- {{cookiecutter.project_slug}}/Gruntfile.js | 4 +- {{cookiecutter.project_slug}}/README.rst | 12 ++++- {{cookiecutter.project_slug}}/gulpfile.js | 41 +++++++++++++-- {{cookiecutter.project_slug}}/package.json | 19 +++++++ .../static/sass/project.scss | 50 +------------------ .../templates/base.html | 13 +++++ 7 files changed, 85 insertions(+), 58 deletions(-) diff --git a/docs/project-generation-options.rst b/docs/project-generation-options.rst index 5a0cffe6..d1d36324 100644 --- a/docs/project-generation-options.rst +++ b/docs/project-generation-options.rst @@ -73,7 +73,9 @@ js_task_runner [1] 3. None custom_bootstrap_compilation [n] - If you use Grunt, scaffold out recompiling Bootstrap as as task. (Useful for letting you change Bootstrap variables in real time.) Consult project README for more details. + Scaffold out recompiling Bootstrap as as task, with Gulp_ or Grunt_. + Useful for letting you change Bootstrap variables in real time. + Consult project README for more details. open_source_license [1] Select a software license for the project. The choices are: diff --git a/{{cookiecutter.project_slug}}/Gruntfile.js b/{{cookiecutter.project_slug}}/Gruntfile.js index 6900c4e0..15384c67 100644 --- a/{{cookiecutter.project_slug}}/Gruntfile.js +++ b/{{cookiecutter.project_slug}}/Gruntfile.js @@ -61,7 +61,7 @@ module.exports = function (grunt) { options: { outputStyle: 'nested', {% if cookiecutter.custom_bootstrap_compilation == 'y' %} - includePaths: ['bower_components/bootstrap-sass/assets/stylesheets/bootstrap/'], + includePaths: ['node_modules/bootstrap/scss'], {% endif %} sourceMap: false, precision: 10 @@ -74,7 +74,7 @@ module.exports = function (grunt) { options: { outputStyle: 'compressed', {% if cookiecutter.custom_bootstrap_compilation == 'y' %} - includePaths: ['bower_components/bootstrap-sass/assets/stylesheets/bootstrap/'], + includePaths: ['node_modules/bootstrap/scss'], {% endif %} sourceMap: false, precision: 10 diff --git a/{{cookiecutter.project_slug}}/README.rst b/{{cookiecutter.project_slug}}/README.rst index 06dd82ed..dc3495d5 100644 --- a/{{cookiecutter.project_slug}}/README.rst +++ b/{{cookiecutter.project_slug}}/README.rst @@ -137,8 +137,16 @@ See detailed `cookiecutter-django Docker documentation`_. Custom Bootstrap Compilation ^^^^^^ -To get automatic Bootstrap recompilation with variables of your choice, install bootstrap sass (`bower install bootstrap-sass`) and tweak your variables in `static/sass/custom_bootstrap_vars`. +The generated CSS is set up with automatic Bootstrap recompilation with variables of your choice. +Bootstrap v4 is installed using npm and customised by tweaking your variables in ``static/sass/custom_bootstrap_vars``. -(You can find a list of available variables [in the bootstrap-sass source](https://github.com/twbs/bootstrap-sass/blob/master/assets/stylesheets/bootstrap/_variables.scss), or get explanations on them in the [Bootstrap docs](https://getbootstrap.com/customize/).) +You can find a list of available variables `in the bootstrap source`_, or get explanations on them in the `Bootstrap docs`_. + +{% if cookiecutter.js_task_runner == 'Gulp' %} +Bootstrap's javascript as well as its dependencies is concatenated into a single file: ``static/js/vendors.js``. +{% endif %} + +.. _in the bootstrap source: https://github.com/twbs/bootstrap/blob/v4-dev/scss/_variables.scss +.. _Bootstrap docs: https://getbootstrap.com/docs/4.0/getting-started/theming/ {% endif %} diff --git a/{{cookiecutter.project_slug}}/gulpfile.js b/{{cookiecutter.project_slug}}/gulpfile.js index 594fa090..bb18a535 100644 --- a/{{cookiecutter.project_slug}}/gulpfile.js +++ b/{{cookiecutter.project_slug}}/gulpfile.js @@ -10,6 +10,9 @@ var gulp = require('gulp'), sass = require('gulp-sass'), autoprefixer = require('gulp-autoprefixer'), cssnano = require('gulp-cssnano'), + {% if cookiecutter.custom_bootstrap_compilation == 'y' %} + concat = require('gulp-concat'), + {% endif %} rename = require('gulp-rename'), del = require('del'), plumber = require('gulp-plumber'), @@ -25,15 +28,24 @@ var gulp = require('gulp'), // Relative paths function var pathsConfig = function (appName) { this.app = "./" + (appName || pjson.name); + var vendorsRoot = 'node_modules/'; return { + {% if cookiecutter.custom_bootstrap_compilation == 'y' %} + bootstrapSass: vendorsRoot + '/bootstrap/scss', + vendorsJs: [ + vendorsRoot + 'jquery/dist/jquery.slim.js', + vendorsRoot + 'popper.js/dist/umd/popper.js', + vendorsRoot + 'bootstrap/dist/js/bootstrap.js' + ], + {% endif %} app: this.app, templates: this.app + '/templates', css: this.app + '/static/css', sass: this.app + '/static/sass', fonts: this.app + '/static/fonts', images: this.app + '/static/images', - js: this.app + '/static/js', + js: this.app + '/static/js' } }; @@ -45,8 +57,15 @@ var paths = pathsConfig(); // Styles autoprefixing and minification gulp.task('styles', function() { - return gulp.src(paths.sass + '/*.scss') - .pipe(sass().on('error', sass.logError)) + return gulp.src(paths.sass + '/project.scss') + .pipe(sass({ + includePaths: [ + {% if cookiecutter.custom_bootstrap_compilation == 'y' %} + paths.bootstrapSass, + {% endif %} + paths.sass + ] + }).on('error', sass.logError)) .pipe(plumber()) // Checks for errors .pipe(autoprefixer({browsers: ['last 2 versions']})) // Adds vendor prefixes .pipe(pixrem()) // add fallbacks for rem units @@ -65,6 +84,20 @@ gulp.task('scripts', function() { .pipe(gulp.dest(paths.js)); }); + +{% if cookiecutter.custom_bootstrap_compilation == 'y' %} +// Vendor Javascript minification +gulp.task('vendor-scripts', function() { + return gulp.src(paths.vendorsJs) + .pipe(concat('vendors.js')) + .pipe(gulp.dest(paths.js)) + .pipe(plumber()) // Checks for errors + .pipe(uglify()) // Minifies the js + .pipe(rename({ suffix: '.min' })) + .pipe(gulp.dest(paths.js)); +}); +{% endif %} + // Image compression gulp.task('imgCompression', function(){ return gulp.src(paths.images + '/*') @@ -101,5 +134,5 @@ gulp.task('watch', function() { // Default task gulp.task('default', function() { - runSequence(['styles', 'scripts', 'imgCompression'], ['runServer', 'browserSync', 'watch']); + runSequence(['styles', 'scripts', {% if cookiecutter.custom_bootstrap_compilation == 'y' %}'vendor-scripts', {% endif %}'imgCompression'], ['runServer', 'browserSync', 'watch']); }); diff --git a/{{cookiecutter.project_slug}}/package.json b/{{cookiecutter.project_slug}}/package.json index 0c8af427..a37d73bf 100644 --- a/{{cookiecutter.project_slug}}/package.json +++ b/{{cookiecutter.project_slug}}/package.json @@ -5,6 +5,9 @@ "devDependencies": { {% if cookiecutter.js_task_runner == 'Grunt' %} "autoprefixer-core": "~5.2.1", + {% if cookiecutter.custom_bootstrap_compilation == 'y' %} + "bootstrap": "^4.0.0", + {% endif %} "connect-livereload": "~0.3.2", "cssnano": "~2.1.0", "grunt": "~0.4.5", @@ -12,14 +15,26 @@ "grunt-contrib-watch": "~0.6.1", "grunt-postcss": "~0.5.5", "grunt-sass": "~1.0.0", + {% if cookiecutter.custom_bootstrap_compilation == 'y' %} + "jquery": "^3.2.1-slim", + {% endif %} "load-grunt-tasks": "~3.2.0", "pixrem": "~1.3.1", + {% if cookiecutter.custom_bootstrap_compilation == 'y' %} + "popper.js": "^1.12.3", + {% endif %} "time-grunt": "~1.2.1" {% elif cookiecutter.js_task_runner == 'Gulp' %} + {% if cookiecutter.custom_bootstrap_compilation == 'y' %} + "bootstrap": "^4.0.0", + {% endif %} "browser-sync": "^2.14.0", "del": "^2.2.2", "gulp": "^3.9.1", "gulp-autoprefixer": "^3.1.1", + {% if cookiecutter.custom_bootstrap_compilation == 'y' %} + "gulp-concat": "^2.6.1", + {% endif %} "gulp-cssnano": "^2.1.2", "gulp-imagemin": "^3.0.3", "gulp-pixrem": "^1.0.0", @@ -28,6 +43,10 @@ "gulp-sass": "^2.3.2", "gulp-uglify": "^2.0.0", "gulp-util": "^3.0.7", + {% if cookiecutter.custom_bootstrap_compilation == 'y' %} + "jquery": "^3.2.1-slim", + "popper.js": "^1.12.3", + {% endif %} "run-sequence": "^1.2.2" {% endif %} }, diff --git a/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/static/sass/project.scss b/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/static/sass/project.scss index 6e701f29..3ba2e55a 100644 --- a/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/static/sass/project.scss +++ b/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/static/sass/project.scss @@ -1,54 +1,6 @@ {% if cookiecutter.custom_bootstrap_compilation == 'y' %} -@import "variables"; @import "custom_bootstrap_vars"; -@import "mixins"; - -// Reset and dependencies -@import "normalize"; -@import "print"; -@import "glyphicons"; - -// Core CSS -@import "scaffolding"; -@import "type"; -@import "code"; -@import "grid"; -@import "tables"; -@import "forms"; -@import "buttons"; - -// Components -@import "component-animations"; -@import "dropdowns"; -@import "button-groups"; -@import "input-groups"; -@import "navs"; -@import "navbar"; -@import "breadcrumbs"; -@import "pagination"; -@import "pager"; -@import "labels"; -@import "badges"; -@import "jumbotron"; -@import "thumbnails"; -@import "alerts"; -@import "progress-bars"; -@import "media"; -@import "list-group"; -@import "panels"; -@import "responsive-embed"; -@import "wells"; -@import "close"; - -// Components w/ JavaScript -@import "modals"; -@import "tooltip"; -@import "popovers"; -@import "carousel"; - -// Utility classes -@import "utilities"; -@import "responsive-utilities"; +@import "bootstrap"; {% endif %} diff --git a/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/templates/base.html b/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/templates/base.html index 6fdc1798..a45de763 100644 --- a/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/templates/base.html +++ b/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/templates/base.html @@ -14,13 +14,19 @@ {% block css %} + {% endraw %}{% if cookiecutter.custom_bootstrap_compilation == "n" %}{% raw %} + {% endraw %}{% endif %}{% raw %} {% endraw %}{% if cookiecutter.use_compressor == "y" %}{% raw %}{% compress css %}{% endraw %}{% endif %}{% raw %} + {% endraw %}{% if cookiecutter.js_task_runner == "Gulp" %}{% raw %} + + {% endraw %}{% else %}{% raw %} + {% endraw %}{% endif %}{% raw %} {% endraw %}{% if cookiecutter.use_compressor == "y" %}{% raw %}{% endcompress %}{% endraw %}{% endif %}{% raw %} {% endblock %} @@ -88,12 +94,19 @@ ================================================== --> {% block javascript %} + {% endraw %}{% if cookiecutter.custom_bootstrap_compilation == "y" and cookiecutter.js_task_runner == "Gulp" %}{% raw %} + + {% endraw %}{% if cookiecutter.use_compressor == "y" %}{% raw %}{% compress js %}{% endraw %}{% endif %}{% raw %} + + {% endraw %}{% if cookiecutter.use_compressor == "y" %}{% raw %}{% endcompress %}{% endraw %}{% endif %}{% raw %} + {% endraw %}{% else %}{% raw %} + {% endraw %}{% endif %}{% raw %} {% endraw %}{% if cookiecutter.use_compressor == "y" %}{% raw %}{% compress js %}{% endraw %}{% endif %}{% raw %} From 3f499f16c377ca9a7626f9e2b7834e2b1a4d3a52 Mon Sep 17 00:00:00 2001 From: Elena Williams Date: Tue, 23 Jan 2018 13:37:53 +1100 Subject: [PATCH 13/41] Update versions and option in README (#1463) Postgres versions had been updated and `custom_bootstrap_complation` had been added in the 'Usage' section. --- README.rst | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/README.rst b/README.rst index b8ecc035..b4656239 100644 --- a/README.rst +++ b/README.rst @@ -167,16 +167,19 @@ Answer the prompts with your own desired options_. For example:: use_heroku [n]: y use_compressor [n]: y Select postgresql_version: - 1 - 9.5 - 2 - 9.4 - 3 - 9.3 - 4 - 9.2 + 1 - 10 + 2 - 9.6 + 3 - 9.5 + 4 - 9.4 + 5 - 9.3 + 6 - 9.2 Choose from 1, 2, 3, 4 [1]: 1 Select js_task_runner: 1 - Gulp 2 - Grunt 3 - None Choose from 1, 2, 3, 4 [1]: 1 + custom_bootstrap_compilation [n]: n Select open_source_license: 1 - MIT 2 - BSD From ec6dd4fd029bff96ac5003141bdfdad03ee948d2 Mon Sep 17 00:00:00 2001 From: "pyup.io bot" Date: Tue, 23 Jan 2018 16:47:48 +0100 Subject: [PATCH 14/41] Update boto3 from 1.5.14 to 1.5.20 (#1464) --- {{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 79a0cf2b..68815230 100644 --- a/{{cookiecutter.project_slug}}/requirements/production.txt +++ b/{{cookiecutter.project_slug}}/requirements/production.txt @@ -16,7 +16,7 @@ gunicorn==19.7.1 # Static and Media Storage # ------------------------------------------------ -boto3==1.5.14 +boto3==1.5.20 django-storages==1.6.5 {% if cookiecutter.use_whitenoise != 'y' -%} Collectfast==0.6.0 From 2d041b6c4d5ac98ae939ee54e30c91093655f8b1 Mon Sep 17 00:00:00 2001 From: "pyup.io bot" Date: Tue, 23 Jan 2018 16:48:00 +0100 Subject: [PATCH 15/41] Update raven from 6.4.0 to 6.5.0 (#1460) --- {{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 68815230..65cba286 100644 --- a/{{cookiecutter.project_slug}}/requirements/production.txt +++ b/{{cookiecutter.project_slug}}/requirements/production.txt @@ -29,7 +29,7 @@ django-anymail==1.2 {% if cookiecutter.use_sentry_for_error_reporting == "y" -%} # Raven is the Sentry client # -------------------------- -raven==6.4.0 +raven==6.5.0 {%- endif %} {% if cookiecutter.use_opbeat == "y" -%} From 8e68df4ac460639dc336c8fbe02a041f53c02ba2 Mon Sep 17 00:00:00 2001 From: "pyup.io bot" Date: Mon, 29 Jan 2018 17:06:59 +0100 Subject: [PATCH 16/41] Update factory-boy to 2.10.0 (#1469) * Update factory-boy from 2.9.2 to 2.10.0 * Update factory-boy from 2.9.2 to 2.10.0 --- {{cookiecutter.project_slug}}/requirements/local.txt | 2 +- {{cookiecutter.project_slug}}/requirements/test.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/{{cookiecutter.project_slug}}/requirements/local.txt b/{{cookiecutter.project_slug}}/requirements/local.txt index 2622b778..6a6514ce 100644 --- a/{{cookiecutter.project_slug}}/requirements/local.txt +++ b/{{cookiecutter.project_slug}}/requirements/local.txt @@ -8,7 +8,7 @@ Sphinx==1.6.6 django-extensions==1.9.9 Werkzeug==0.14.1 django-test-plus==1.0.22 -factory-boy==2.9.2 +factory-boy==2.10.0 django-debug-toolbar==1.9.1 diff --git a/{{cookiecutter.project_slug}}/requirements/test.txt b/{{cookiecutter.project_slug}}/requirements/test.txt index 01e02c21..6ef082af 100644 --- a/{{cookiecutter.project_slug}}/requirements/test.txt +++ b/{{cookiecutter.project_slug}}/requirements/test.txt @@ -10,7 +10,7 @@ psycopg2==2.7.3.2 coverage==4.4.2 flake8==3.5.0 # pyup: != 2.6.0 django-test-plus==1.0.22 -factory-boy==2.9.2 +factory-boy==2.10.0 django-coverage-plugin==1.5.0 # pytest From 8a4f3e036b7f2c089e0442cb6d32959291b0c97c Mon Sep 17 00:00:00 2001 From: "pyup.io bot" Date: Mon, 29 Jan 2018 17:07:10 +0100 Subject: [PATCH 17/41] Update boto3 from 1.5.20 to 1.5.22 (#1468) --- {{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 65cba286..d0d4b52f 100644 --- a/{{cookiecutter.project_slug}}/requirements/production.txt +++ b/{{cookiecutter.project_slug}}/requirements/production.txt @@ -16,7 +16,7 @@ gunicorn==19.7.1 # Static and Media Storage # ------------------------------------------------ -boto3==1.5.20 +boto3==1.5.22 django-storages==1.6.5 {% if cookiecutter.use_whitenoise != 'y' -%} Collectfast==0.6.0 From dc8a8a43ca3f0334d9b1d9a7f80ef63957eea127 Mon Sep 17 00:00:00 2001 From: Bruno Alla Date: Tue, 30 Jan 2018 22:55:36 +0000 Subject: [PATCH 18/41] Add Code triage badge [Code triage](https://www.codetriage.com/)is a service that nudge people to help triage issues from OSS they care about. It's picking a random issue from a project people follow and send it to their inbox. --- README.rst | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.rst b/README.rst index b4656239..4fdb7745 100644 --- a/README.rst +++ b/README.rst @@ -12,6 +12,10 @@ Cookiecutter Django .. image:: https://badges.gitter.im/Join Chat.svg :target: https://gitter.im/pydanny/cookiecutter-django?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge +.. image:: https://www.codetriage.com/pydanny/cookiecutter-django/badges/users.svg + :target: https://www.codetriage.com/pydanny/cookiecutter-django + :alt: Open Source Helpers + Powered by Cookiecutter_, Cookiecutter Django is a framework for jumpstarting production-ready Django projects quickly. From fe7c4aa815f6fce1e9a79f3449daf232dacc175d Mon Sep 17 00:00:00 2001 From: "pyup.io bot" Date: Thu, 1 Feb 2018 22:39:04 +0100 Subject: [PATCH 19/41] Update django from 1.11.9 to 1.11.10 (#1474) --- {{cookiecutter.project_slug}}/requirements/base.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/{{cookiecutter.project_slug}}/requirements/base.txt b/{{cookiecutter.project_slug}}/requirements/base.txt index 81a375b1..a4c5f483 100644 --- a/{{cookiecutter.project_slug}}/requirements/base.txt +++ b/{{cookiecutter.project_slug}}/requirements/base.txt @@ -6,7 +6,7 @@ wheel==0.30.0 # Conservative Django -django==1.11.9 # pyup: <2.0 +django==1.11.10 # pyup: <2.0 # Configuration django-environ==0.4.4 From cfbf49f36b4d78e950d3899c1e601ae8604ae4da Mon Sep 17 00:00:00 2001 From: "pyup.io bot" Date: Fri, 2 Feb 2018 14:30:20 +0100 Subject: [PATCH 20/41] Update opbeat from 3.6.0 to 3.6.1 (#1473) --- {{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 d0d4b52f..26927029 100644 --- a/{{cookiecutter.project_slug}}/requirements/production.txt +++ b/{{cookiecutter.project_slug}}/requirements/production.txt @@ -35,5 +35,5 @@ raven==6.5.0 {% if cookiecutter.use_opbeat == "y" -%} # Opbeat agent for performance monitoring # ----------------------------------------- -opbeat==3.6.0 +opbeat==3.6.1 {%- endif %} From e0ac7f9b7383beb0cbb2ec88eacee0ce1c3185a3 Mon Sep 17 00:00:00 2001 From: Bruno Alla Date: Fri, 2 Feb 2018 19:04:24 +0000 Subject: [PATCH 21/41] Adding myself to the core developers list (#1475) --- CONTRIBUTORS.rst | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/CONTRIBUTORS.rst b/CONTRIBUTORS.rst index 4cf632db..d5f9bc76 100644 --- a/CONTRIBUTORS.rst +++ b/CONTRIBUTORS.rst @@ -7,17 +7,18 @@ Core Developers These contributors have commit flags for the repository, and are able to accept and merge pull requests. -=========================== ============= =========== -Name Github Twitter -=========================== ============= =========== -Daniel Roy Greenfeld `@pydanny`_ @pydanny -Audrey Roy Greenfeld* `@audreyr`_ @audreyr -Fábio C. Barrionuevo da Luz `@luzfcb`_ @luzfcb -Saurabh Kumar `@theskumar`_ @_theskumar +=========================== ================ =========== +Name Github Twitter +=========================== ================ =========== +Daniel Roy Greenfeld `@pydanny`_ @pydanny +Audrey Roy Greenfeld* `@audreyr`_ @audreyr +Fábio C. Barrionuevo da Luz `@luzfcb`_ @luzfcb +Saurabh Kumar `@theskumar`_ @_theskumar Jannis Gebauer `@jayfk`_ -Burhan Khalid `@burhan`_ @burhan -Shupeyko Nikita `@webyneter`_ @webyneter -=========================== ============= =========== +Burhan Khalid `@burhan`_ @burhan +Shupeyko Nikita `@webyneter`_ @webyneter +Bruno Alla               `@browniebroke`_ @_BrunoAlla +=========================== ================ =========== *Audrey is also the creator of Cookiecutter. Audrey and Daniel are on the Cookiecutter core team.* @@ -28,6 +29,7 @@ Daniel are on the Cookiecutter core team.* .. _@audreyr: https://github.com/audreyr .. _@jayfk: https://github.com/jayfk .. _@webyneter: https://github.com/webyneter +.. _@browniebroke: https://github.com/browniebroke Other Contributors ------------------ @@ -64,7 +66,6 @@ Listed in alphabetical order. Bo Lopker `@blopker`_ Bouke Haarsma Brent Payne `@brentpayne`_ @brentpayne - Bruno Alla               `@browniebroke`_ @_BrunoAlla Burhan Khalid            `@burhan`_                   @burhan Catherine Devlin `@catherinedevlin`_ Cédric Gaspoz `@cgaspoz`_ @@ -171,7 +172,6 @@ Listed in alphabetical order. .. _@bloodpet: https://github.com/bloodpet .. _@blopker: https://github.com/blopker .. _@bogdal: https://github.com/bogdal -.. _@browniebroke: https://github.com/browniebroke .. _@burhan: https://github.com/burhan .. _@c-rhodes: https://github.com/c-rhodes .. _@caffodian: https://github.com/caffodian @@ -228,7 +228,6 @@ Listed in alphabetical order. .. _@rm--: https://github.com/rm-- .. _@romanosipenko: https://github.com/romanosipenko .. _@shireenrao: https://github.com/shireenrao -.. _@webyneter: https://github.com/webyneter .. _@show0k: https://github.com/show0k .. _@sfdye: https://github.com/sfdye .. _@shultz: https://github.com/shultz From a191f54c9bb0e362ce7ef6317ae54e1436d3ee71 Mon Sep 17 00:00:00 2001 From: Bruno Alla Date: Fri, 2 Feb 2018 19:18:06 +0000 Subject: [PATCH 22/41] Fix a few broken links in the contributors list --- CONTRIBUTORS.rst | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/CONTRIBUTORS.rst b/CONTRIBUTORS.rst index d5f9bc76..a9a85773 100644 --- a/CONTRIBUTORS.rst +++ b/CONTRIBUTORS.rst @@ -239,7 +239,7 @@ Listed in alphabetical order. .. _@timfreund: https://github.com/timfreund .. _@Travistock: https://github.com/Tavistock .. _@trungdong: https://github.com/trungdong -.. _@viviangb: httpsL//github.com/viviangb +.. _@viviangb: https://github.com/viviangb .. _@xpostudio4: https://github.com/xpostudio4 .. _@yunti: https://github.com/yunti .. _@zcho: https://github.com/zcho @@ -249,6 +249,12 @@ Listed in alphabetical order. .. _@jangeador: https://github.com/jangeador .. _@townie: https://github.com/townie .. _@MightySCollins: https://github.com/MightySCollins +.. _@dadokkio: https://github.com/dadokkio +.. _@bwarren2: https://github.com/bwarren2 +.. _@bertdemiranda: https://github.com/bertdemiranda +.. _@brentpayne: https://github.com/brentpayne +.. _@afrowave: https://github.com/afrowave +.. _@pchiquet: https://github.com/pchiquet Special Thanks ~~~~~~~~~~~~~~ From b19b1e0f3c9f099e07d0d013b9e3432d18937efb Mon Sep 17 00:00:00 2001 From: "pyup.io bot" Date: Fri, 2 Feb 2018 21:43:02 +0100 Subject: [PATCH 23/41] Update django-allauth from 0.34.0 to 0.35.0 (#1477) --- {{cookiecutter.project_slug}}/requirements/base.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/{{cookiecutter.project_slug}}/requirements/base.txt b/{{cookiecutter.project_slug}}/requirements/base.txt index a4c5f483..b2595156 100644 --- a/{{cookiecutter.project_slug}}/requirements/base.txt +++ b/{{cookiecutter.project_slug}}/requirements/base.txt @@ -29,7 +29,7 @@ argon2-cffi==18.1.0 # For user registration, either via email or social # Well-built with regular release cycles! -django-allauth==0.34.0 +django-allauth==0.35.0 {% if cookiecutter.windows == 'y' -%} # On Windows, you must download/install psycopg2 manually From 4b7a70d8753a058e3d120656dfdaaf8567dc46ab Mon Sep 17 00:00:00 2001 From: "pyup.io bot" Date: Fri, 2 Feb 2018 21:54:07 +0100 Subject: [PATCH 24/41] Update django-anymail from 1.2 to 1.3 (#1478) --- {{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 26927029..15740618 100644 --- a/{{cookiecutter.project_slug}}/requirements/production.txt +++ b/{{cookiecutter.project_slug}}/requirements/production.txt @@ -24,7 +24,7 @@ Collectfast==0.6.0 # Email backends for Mailgun, Postmark, SendGrid and more # ------------------------------------------------------- -django-anymail==1.2 +django-anymail==1.3 {% if cookiecutter.use_sentry_for_error_reporting == "y" -%} # Raven is the Sentry client From b24d0d0bd889a50ab042c140b77d22538279355f Mon Sep 17 00:00:00 2001 From: David Date: Fri, 2 Feb 2018 22:01:28 +0100 Subject: [PATCH 25/41] Fixes wsgi.py app_path to avoid deleting all /config occurrences. (#1467) --- {{cookiecutter.project_slug}}/config/wsgi.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/{{cookiecutter.project_slug}}/config/wsgi.py b/{{cookiecutter.project_slug}}/config/wsgi.py index 601d27c6..5f49644c 100644 --- a/{{cookiecutter.project_slug}}/config/wsgi.py +++ b/{{cookiecutter.project_slug}}/config/wsgi.py @@ -20,7 +20,8 @@ from django.core.wsgi import get_wsgi_application # This allows easy placement of apps within the interior # {{ cookiecutter.project_slug }} directory. -app_path = os.path.dirname(os.path.abspath(__file__)).replace('/config', '') +app_path = os.path.abspath(os.path.join( + os.path.dirname(os.path.abspath(__file__)), os.pardir)) sys.path.append(os.path.join(app_path, '{{ cookiecutter.project_slug }}')) {% if cookiecutter.use_sentry_for_error_reporting == 'y' -%} From b66d7a4f04324e187cc1a85e41d6a4be6bc8b6bb Mon Sep 17 00:00:00 2001 From: Bruno Alla Date: Fri, 2 Feb 2018 23:40:42 +0000 Subject: [PATCH 26/41] Rename badge --- README.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.rst b/README.rst index 4fdb7745..6536ab7e 100644 --- a/README.rst +++ b/README.rst @@ -14,7 +14,7 @@ Cookiecutter Django .. image:: https://www.codetriage.com/pydanny/cookiecutter-django/badges/users.svg :target: https://www.codetriage.com/pydanny/cookiecutter-django - :alt: Open Source Helpers + :alt: Code Helpers Badge Powered by Cookiecutter_, Cookiecutter Django is a framework for jumpstarting production-ready Django projects quickly. From 4f4c51d2bfa90d9d2d013f2e50b561efb33539c9 Mon Sep 17 00:00:00 2001 From: pyup-bot Date: Sun, 4 Feb 2018 00:26:04 -0800 Subject: [PATCH 27/41] Update coverage from 4.4.2 to 4.5 --- {{cookiecutter.project_slug}}/requirements/local.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/{{cookiecutter.project_slug}}/requirements/local.txt b/{{cookiecutter.project_slug}}/requirements/local.txt index 6a6514ce..fad86434 100644 --- a/{{cookiecutter.project_slug}}/requirements/local.txt +++ b/{{cookiecutter.project_slug}}/requirements/local.txt @@ -1,7 +1,7 @@ # Local development dependencies go here -r base.txt -coverage==4.4.2 +coverage==4.5 django-coverage-plugin==1.5.0 Sphinx==1.6.6 From a0abb0cc222236f4cbbb55cedf07a595b6c0ca50 Mon Sep 17 00:00:00 2001 From: pyup-bot Date: Sun, 4 Feb 2018 00:26:06 -0800 Subject: [PATCH 28/41] Update coverage from 4.4.2 to 4.5 --- {{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 6ef082af..b5a8ec98 100644 --- a/{{cookiecutter.project_slug}}/requirements/test.txt +++ b/{{cookiecutter.project_slug}}/requirements/test.txt @@ -7,7 +7,7 @@ psycopg2==2.7.3.2 {%- endif %} -coverage==4.4.2 +coverage==4.5 flake8==3.5.0 # pyup: != 2.6.0 django-test-plus==1.0.22 factory-boy==2.10.0 From 179adb4f30dfeeace03e6c5fe876e473b0737d02 Mon Sep 17 00:00:00 2001 From: pyup-bot Date: Sun, 4 Feb 2018 16:35:06 -0800 Subject: [PATCH 29/41] Update sphinx from 1.6.6 to 1.6.7 --- {{cookiecutter.project_slug}}/requirements/local.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/{{cookiecutter.project_slug}}/requirements/local.txt b/{{cookiecutter.project_slug}}/requirements/local.txt index fad86434..2fccb409 100644 --- a/{{cookiecutter.project_slug}}/requirements/local.txt +++ b/{{cookiecutter.project_slug}}/requirements/local.txt @@ -4,7 +4,7 @@ coverage==4.5 django-coverage-plugin==1.5.0 -Sphinx==1.6.6 +Sphinx==1.6.7 django-extensions==1.9.9 Werkzeug==0.14.1 django-test-plus==1.0.22 From 19547ac937ad0872ac3ec9ba5845ffb58d9925ff Mon Sep 17 00:00:00 2001 From: Bruno Alla Date: Mon, 5 Feb 2018 15:10:49 +0000 Subject: [PATCH 30/41] Bootstrap4 workarounds cleanup (#1470) * Cleanup workaround CSS for Bootstrap 4 + DDT fix * Cleanup custom Bootstrap 4 + crispy forms workaround --- .../static/css/project.css | 8 --- .../static/sass/project.scss | 12 ----- .../templates/bootstrap4/field.html | 50 ------------------- .../bootstrap4/layout/field_errors_block.html | 7 --- 4 files changed, 77 deletions(-) delete mode 100644 {{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/templates/bootstrap4/field.html delete mode 100644 {{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/templates/bootstrap4/layout/field_errors_block.html diff --git a/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/static/css/project.css b/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/static/css/project.css index a7725c91..f1d543da 100644 --- a/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/static/css/project.css +++ b/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/static/css/project.css @@ -11,11 +11,3 @@ background-color: #f2dede; border-color: #eed3d7; } - -/* Display django-debug-toolbar. - See https://github.com/django-debug-toolbar/django-debug-toolbar/issues/742 - and https://github.com/pydanny/cookiecutter-django/issues/317 -*/ -[hidden][style="display: block;"] { - display: block !important; -} diff --git a/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/static/sass/project.scss b/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/static/sass/project.scss index 3ba2e55a..9fbf1b74 100644 --- a/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/static/sass/project.scss +++ b/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/static/sass/project.scss @@ -38,15 +38,3 @@ $red: #b94a48; border-color: $dark-pink; color: $red; } - -//////////////////////////////// - //Django Toolbar// -//////////////////////////////// - -// Display django-debug-toolbar. -// See https://github.com/django-debug-toolbar/django-debug-toolbar/issues/742 -// and https://github.com/pydanny/cookiecutter-django/issues/317 - -[hidden][style="display: block;"] { - display: block !important; -} diff --git a/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/templates/bootstrap4/field.html b/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/templates/bootstrap4/field.html deleted file mode 100644 index 2943e719..00000000 --- a/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/templates/bootstrap4/field.html +++ /dev/null @@ -1,50 +0,0 @@ -{% raw %} -{% load crispy_forms_field %} - -{% if field.is_hidden %} - {{ field }} -{% else %} - {% if field|is_checkbox %} -
- {% if label_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 %} - - {% 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 %} - - {% else %} -
- {% crispy_field field %} -
- {% include 'bootstrap4/layout/help_text_and_errors.html' %} - {% endif %} - {% endif %} - - {% if field|is_checkbox %} - {% if label_class %} -
- {% endif %} -
- {% endif %} -{% endif %} -{% endraw %} \ No newline at end of file diff --git a/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/templates/bootstrap4/layout/field_errors_block.html b/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/templates/bootstrap4/layout/field_errors_block.html deleted file mode 100644 index 57c979e6..00000000 --- a/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/templates/bootstrap4/layout/field_errors_block.html +++ /dev/null @@ -1,7 +0,0 @@ -{% raw %} -{% if form_show_errors and field.errors %} - {% for error in field.errors %} -

{{ error }}

- {% endfor %} -{% endif %} -{% endraw %} From fe39d9d4e49d488c02b805985b12eb1ce2d9aa78 Mon Sep 17 00:00:00 2001 From: pyup-bot Date: Mon, 5 Feb 2018 18:26:06 -0800 Subject: [PATCH 31/41] Update boto3 from 1.5.22 to 1.5.23 --- {{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 15740618..def182a7 100644 --- a/{{cookiecutter.project_slug}}/requirements/production.txt +++ b/{{cookiecutter.project_slug}}/requirements/production.txt @@ -16,7 +16,7 @@ gunicorn==19.7.1 # Static and Media Storage # ------------------------------------------------ -boto3==1.5.22 +boto3==1.5.23 django-storages==1.6.5 {% if cookiecutter.use_whitenoise != 'y' -%} Collectfast==0.6.0 From 219b6ba8176dc3bbc7026d04cbc9d7eb7abe1b44 Mon Sep 17 00:00:00 2001 From: Wan Liuyang Date: Wed, 7 Feb 2018 01:16:24 +0800 Subject: [PATCH 32/41] Update pytest-sugar to 0.9.1 (#1486) --- {{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 b5a8ec98..5980a30e 100644 --- a/{{cookiecutter.project_slug}}/requirements/test.txt +++ b/{{cookiecutter.project_slug}}/requirements/test.txt @@ -15,4 +15,4 @@ django-coverage-plugin==1.5.0 # pytest pytest-django==3.1.2 -pytest-sugar==0.9.0 +pytest-sugar==0.9.1 From e9511a173512e0fcb8a5c7cb51e0587bb39fbf2c Mon Sep 17 00:00:00 2001 From: "pyup.io bot" Date: Tue, 6 Feb 2018 18:17:39 +0100 Subject: [PATCH 33/41] Update pytest-sugar from 0.9.0 to 0.9.1 (#1489) --- {{cookiecutter.project_slug}}/requirements/local.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/{{cookiecutter.project_slug}}/requirements/local.txt b/{{cookiecutter.project_slug}}/requirements/local.txt index 2fccb409..63ec8a53 100644 --- a/{{cookiecutter.project_slug}}/requirements/local.txt +++ b/{{cookiecutter.project_slug}}/requirements/local.txt @@ -16,4 +16,4 @@ django-debug-toolbar==1.9.1 ipdb==0.10.3 pytest-django==3.1.2 -pytest-sugar==0.9.0 +pytest-sugar==0.9.1 From 3512bb6c32ac3a8821ba5a2d79ca1278eda11940 Mon Sep 17 00:00:00 2001 From: Reggie Riser Date: Tue, 6 Feb 2018 17:18:03 -0500 Subject: [PATCH 34/41] Delete deployment-with-elastic-beanstalk.rst --- docs/deployment-with-elastic-beanstalk.rst | 72 ---------------------- 1 file changed, 72 deletions(-) delete mode 100644 docs/deployment-with-elastic-beanstalk.rst diff --git a/docs/deployment-with-elastic-beanstalk.rst b/docs/deployment-with-elastic-beanstalk.rst deleted file mode 100644 index 5edf1795..00000000 --- a/docs/deployment-with-elastic-beanstalk.rst +++ /dev/null @@ -1,72 +0,0 @@ -Deployment with Elastic Beanstalk -========================================== - -.. index:: Elastic Beanstalk - -Warning: Experimental ---------------------- - -This is experimental. For the time being there will be bugs and issues. If you've never used Elastic Beanstalk before, please hold off before trying this option. - -On the other hand, we need help cleaning this up. If you do have knowledge of Elastic Beanstalk, we would appreciate the help. :) - -Prerequisites -------------- - -* awsebcli - -Instructions -------------- - -If you haven't done so, create a directory of environments:: - - eb init -p python3.6 MY_PROJECT_SLUG - -Replace `MY_PROJECT_SLUG` with the value you entered for `project_slug`. - -Once that is done, create the environment (server) where the app will run:: - - eb create MY_PROJECT_SLUG - # Note: This will eventually fail on a postgres error, because postgres doesn't exist yet - -Now make sure you are in the right environment:: - - eb list - -If you are not in the right environment, then put yourself in the correct one:: - - eb use MY_PROJECT_SLUG - -Set the environment variables. Notes: You will be prompted if the `.env` file is missing. The script will ignore any PostgreSQL values, as RDS uses it's own system:: - - # Set the environment variables - python ebsetenv.py - -Speaking of PostgreSQL, go to the Elasting Beanstalk configuration panel for RDS. Create new RDS database, with these attributes: - -* PostgreSQL -* Version 9.4.9 -* Size db.t2.micro (You can upgrade later) - -(Get some coffee, this is going to take a while) - -Once you have a database specified, deploy again so your instance can pick up the new PostgreSQL values:: - - eb deploy - -Take a look:: - - eb open - -FAQ ------ - -Why Not Use Docker on Elastic Beanstalk? -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -Because I didn't want to add an abstraction (Docker) on top of an abstraction (Elastic Beanstalk) on top of an abstraction (Cookiecutter Django). - -Why Can't I Use Both Docker/Heroku with Elastic Beanstalk? -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -Because the environment variables that our Docker and Heroku setups use for PostgreSQL access is different then how Amazon RDS handles this access. At this time we're just trying to get things to work reliably with Elastic Beanstalk, and full integration will come later. From 1148802655a4711bd5a8dd5e968271f099ba1182 Mon Sep 17 00:00:00 2001 From: "pyup.io bot" Date: Wed, 7 Feb 2018 00:52:44 +0100 Subject: [PATCH 35/41] Update boto3 from 1.5.23 to 1.5.24 (#1492) --- {{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 def182a7..001937eb 100644 --- a/{{cookiecutter.project_slug}}/requirements/production.txt +++ b/{{cookiecutter.project_slug}}/requirements/production.txt @@ -16,7 +16,7 @@ gunicorn==19.7.1 # Static and Media Storage # ------------------------------------------------ -boto3==1.5.23 +boto3==1.5.24 django-storages==1.6.5 {% if cookiecutter.use_whitenoise != 'y' -%} Collectfast==0.6.0 From 5ffeb2bbdd6a599bc758f839b96e9d948a82ad86 Mon Sep 17 00:00:00 2001 From: Reggie Riser Date: Wed, 7 Feb 2018 08:45:56 -0500 Subject: [PATCH 36/41] Update heroku runtime to 3.6.4 --- {{cookiecutter.project_slug}}/runtime.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/{{cookiecutter.project_slug}}/runtime.txt b/{{cookiecutter.project_slug}}/runtime.txt index 02d0df5e..5c453803 100644 --- a/{{cookiecutter.project_slug}}/runtime.txt +++ b/{{cookiecutter.project_slug}}/runtime.txt @@ -1 +1 @@ -python-3.6.3 +python-3.6.4 From 86e33e8714c92a85a1c7dbba4b47ced4f36756a9 Mon Sep 17 00:00:00 2001 From: Nikita Shupeyko Date: Wed, 7 Feb 2018 22:52:52 +0300 Subject: [PATCH 37/41] Refactor *_gen_project hooks (#1490) * Fix ./hooks/pre_gen_project.py asking user to select an option once only + prettify output * Fix pre_gen hook not really exiting when it should * Refactor & prettify ./hooks/post_gen_project.py * Ensure same POSTGRES_USER is set across environments + get rid of env.example in favor of pre-generated .env. --- docs/settings.rst | 2 +- hooks/post_gen_project.py | 435 ++++++++++-------- hooks/pre_gen_project.py | 74 ++- .../config/settings/local.py | 2 +- .../config/settings/test.py | 2 +- {{cookiecutter.project_slug}}/env.example | 6 +- {{cookiecutter.project_slug}}/local.yml | 4 +- 7 files changed, 301 insertions(+), 224 deletions(-) diff --git a/docs/settings.rst b/docs/settings.rst index 8b4ad405..20bf9e5e 100644 --- a/docs/settings.rst +++ b/docs/settings.rst @@ -22,7 +22,7 @@ DJANGO_ADMIN_URL n/a r'^admin/' DJANGO_CACHES CACHES (default) locmem redis DJANGO_DATABASES DATABASES (default) See code See code DJANGO_DEBUG DEBUG True False -DJANGO_SECRET_KEY SECRET_KEY CHANGEME!!! raises error +DJANGO_SECRET_KEY SECRET_KEY !!!SET DJANGO_SECRET_KEY!!! raises error DJANGO_SECURE_BROWSER_XSS_FILTER SECURE_BROWSER_XSS_FILTER n/a True DJANGO_SECURE_SSL_REDIRECT SECURE_SSL_REDIRECT n/a True DJANGO_SECURE_CONTENT_TYPE_NOSNIFF SECURE_CONTENT_TYPE_NOSNIFF n/a True diff --git a/hooks/post_gen_project.py b/hooks/post_gen_project.py index 9a6da7b6..0e16ffb7 100644 --- a/hooks/post_gen_project.py +++ b/hooks/post_gen_project.py @@ -1,238 +1,283 @@ """ -Does the following: +NOTE: + the below code is to be maintained Python 2.x-compatible + as the whole Cookiecutter Django project initialization + can potentially be run in Python 2.x environment + (at least so we presume in `pre_gen_project.py`). -1. Generates and saves random secret key -2. Removes the taskapp if celery isn't going to be used -3. Removes the .idea directory if PyCharm isn't going to be used -4. Copy files from /docs/ to {{ cookiecutter.project_slug }}/docs/ - - TODO: this might have to be moved to a pre_gen_hook - -A portion of this code was adopted from Django's standard crypto functions and -utilities, specifically: - https://github.com/django/django/blob/master/django/utils/crypto.py +TODO: ? restrict Cookiecutter Django project initialization to Python 3.x environments only """ -from __future__ import print_function + import os import random import shutil import string +import sys -# Get the root project directory -PROJECT_DIRECTORY = os.path.realpath(os.path.curdir) - -# Use the system PRNG if possible try: + # Inspired by + # https://github.com/django/django/blob/master/django/utils/crypto.py random = random.SystemRandom() using_sysrandom = True except NotImplementedError: using_sysrandom = False - -def get_random_string(length=50): - """ - Returns a securely generated random string. - The default length of 12 with the a-z, A-Z, 0-9 character set returns - a 71-bit value. log_2((26+26+10)^12) =~ 71 bits - """ - punctuation = string.punctuation.replace('"', '').replace("'", '') - punctuation = punctuation.replace('\\', '') - if using_sysrandom: - return ''.join(random.choice( - string.digits + string.ascii_letters + punctuation - ) for i in range(length)) - - print( - "Cookiecutter Django couldn't find a secure pseudo-random number generator on your system." - " Please change change your SECRET_KEY variables in conf/settings/local.py and env.example" - " manually." - ) - return "CHANGEME!!" +PROJECT_DIR_PATH = os.path.realpath(os.path.curdir) -def set_secret_key(setting_file_location): - # Open locals.py - with open(setting_file_location) as f: - file_ = f.read() - - # Generate a SECRET_KEY that matches the Django standard - SECRET_KEY = get_random_string() - - # Replace "CHANGEME!!!" with SECRET_KEY - file_ = file_.replace('CHANGEME!!!', SECRET_KEY, 1) - - # Write the results to the locals.py module - with open(setting_file_location, 'w') as f: - f.write(file_) +def remove_file(file_path): + if os.path.exists(file_path): + os.remove(file_path) -def make_secret_key(project_directory): - """Generates and saves random secret key""" - # Determine the local_setting_file_location - local_setting = os.path.join( - project_directory, - 'config/settings/local.py' - ) - - # local.py settings file - set_secret_key(local_setting) - - env_file = os.path.join( - project_directory, - 'env.example' - ) - - # env.example file - set_secret_key(env_file) +def remove_open_source_project_only_files(): + file_names = [ + 'CONTRIBUTORS.txt', + ] + for file_name in file_names: + os.remove(os.path.join(PROJECT_DIR_PATH, file_name)) -def remove_file(file_name): - if os.path.exists(file_name): - os.remove(file_name) +def remove_gplv3_files(): + file_names = [ + 'COPYING', + ] + for file_name in file_names: + os.remove(os.path.join(PROJECT_DIR_PATH, file_name)) -def remove_task_app(project_directory): - """Removes the taskapp if celery isn't going to be used""" - # Determine the local_setting_file_location - task_app_location = os.path.join( - PROJECT_DIRECTORY, - '{{ cookiecutter.project_slug }}/taskapp' - ) - shutil.rmtree(task_app_location) +def remove_pycharm_files(): + idea_dir_path = os.path.join(PROJECT_DIR_PATH, '.idea') + if os.path.exists(idea_dir_path): + shutil.rmtree(idea_dir_path) - -def remove_pycharm_dir(project_directory): - """ - Removes directories related to PyCharm - if it isn't going to be used - """ - idea_dir_location = os.path.join(PROJECT_DIRECTORY, '.idea/') - if os.path.exists(idea_dir_location): - shutil.rmtree(idea_dir_location) - - docs_dir_location = os.path.join(PROJECT_DIRECTORY, 'docs/pycharm/') - if os.path.exists(docs_dir_location): - shutil.rmtree(docs_dir_location) - - -def remove_heroku_files(): - """ - Removes files needed for heroku if it isn't going to be used - """ - filenames = ["Procfile", "runtime.txt"] - for filename in ["Procfile", "runtime.txt"]: - file_name = os.path.join(PROJECT_DIRECTORY, filename) - remove_file(file_name) + docs_dir_path = os.path.join(PROJECT_DIR_PATH, 'docs', 'pycharm') + if os.path.exists(docs_dir_path): + shutil.rmtree(docs_dir_path) def remove_docker_files(): - """ - Removes files needed for docker if it isn't going to be used - """ - for filename in ["local.yml", "production.yml", ".dockerignore"]: - filename = os.path.join(PROJECT_DIRECTORY, filename) - if os.path.exists(filename): - os.remove(filename) + shutil.rmtree(os.path.join(PROJECT_DIR_PATH, 'compose')) - shutil.rmtree(os.path.join( - PROJECT_DIRECTORY, "compose" - )) + file_names = [ + 'local.yml', + 'production.yml', + '.dockerignore', + ] + for file_name in file_names: + os.remove(os.path.join(PROJECT_DIR_PATH, file_name)) + + +def remove_heroku_files(): + file_names = [ + 'Procfile', + 'runtime.txt', + ] + for file_name in file_names: + remove_file(os.path.join(PROJECT_DIR_PATH, file_name)) + + +def remove_paas_files(): + none_paas_files_left = True + + if '{{ cookiecutter.use_heroku }}'.lower() == 'n': + remove_heroku_files() + none_paas_files_left &= True + else: + none_paas_files_left &= False + + if none_paas_files_left: + remove_file(os.path.join(PROJECT_DIR_PATH, 'requirements.txt')) def remove_grunt_files(): - """ - Removes files needed for grunt if it isn't going to be used - """ - for filename in ["Gruntfile.js"]: - os.remove(os.path.join( - PROJECT_DIRECTORY, filename - )) + file_names = [ + 'Gruntfile.js', + ] + for file_name in file_names: + os.remove(os.path.join(PROJECT_DIR_PATH, file_name)) + def remove_gulp_files(): + file_names = [ + 'gulpfile.js', + ] + for file_name in file_names: + os.remove(os.path.join(PROJECT_DIR_PATH, file_name)) + + +def remove_packagejson_file(): + file_names = [ + 'package.json', + ] + for file_name in file_names: + os.remove(os.path.join(PROJECT_DIR_PATH, file_name)) + + +def remove_celery_app(): + shutil.rmtree(os.path.join(PROJECT_DIR_PATH, '{{ cookiecutter.project_slug }}', 'taskapp')) + + +def append_to_project_gitignore(path): + gitignore_file_path = os.path.join(PROJECT_DIR_PATH, '.gitignore') + with open(gitignore_file_path, 'a') as gitignore_file: + gitignore_file.write(path) + gitignore_file.write(os.linesep) + + +def generate_random_string(length, + using_digits=False, + using_ascii_letters=False, + using_punctuation=False): """ - Removes files needed for grunt if it isn't going to be used + Example: + opting out for 50 symbol-long, [a-z][A-Z][0-9] string + would yield log_2((26+26+50)^50) ~= 334 bit strength. """ - for filename in ["gulpfile.js"]: - os.remove(os.path.join( - PROJECT_DIRECTORY, filename - )) + if not using_sysrandom: + return None -def remove_packageJSON_file(): - """ - Removes files needed for grunt if it isn't going to be used - """ - for filename in ["package.json"]: - os.remove(os.path.join( - PROJECT_DIRECTORY, filename - )) - -def remove_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 - )) + symbols = [] + if using_digits: + symbols += string.digits + if using_ascii_letters: + symbols += string.ascii_letters + if using_punctuation: + symbols += string.punctuation \ + .replace('"', '') \ + .replace("'", '') \ + .replace('\\', '') + return ''.join([random.choice(symbols) for _ in range(length)]) -# IN PROGRESS -# def copy_doc_files(project_directory): -# cookiecutters_dir = DEFAULT_CONFIG['cookiecutters_dir'] -# cookiecutter_django_dir = os.path.join( -# cookiecutters_dir, -# 'cookiecutter-django', -# 'docs' -# ) -# target_dir = os.path.join( -# project_directory, -# 'docs' -# ) -# for name in os.listdir(cookiecutter_django_dir): -# if name.endswith('.rst') and not name.startswith('index'): -# src = os.path.join(cookiecutter_django_dir, name) -# dst = os.path.join(target_dir, name) -# shutil.copyfile(src, dst) +def set_flag(file_path, + flag, + value=None, + *args, + **kwargs): + if value is None: + random_string = generate_random_string(*args, **kwargs) + if random_string is None: + import sys + sys.stdout.write( + "We couldn't find a secure pseudo-random number generator on your system. " + "Please, make sure to manually {} later.".format(flag) + ) + random_string = flag + value = random_string -# 1. Generates and saves random secret key -make_secret_key(PROJECT_DIRECTORY) + with open(file_path, 'r+') as f: + file_contents = f.read().replace(flag, value) + f.seek(0) + f.write(file_contents) + f.truncate() -# 2. Removes the taskapp if celery isn't going to be used -if '{{ cookiecutter.use_celery }}'.lower() == 'n': - remove_task_app(PROJECT_DIRECTORY) - -# 3. Removes the .idea directory if PyCharm isn't going to be used -if '{{ cookiecutter.use_pycharm }}'.lower() != 'y': - remove_pycharm_dir(PROJECT_DIRECTORY) - -# 4. Removes all heroku files if it isn't going to be used -if '{{ cookiecutter.use_heroku }}'.lower() != 'y': - remove_heroku_files() - -# 5. Removes all docker files if it isn't going to be used -if '{{ cookiecutter.use_docker }}'.lower() != 'y': - remove_docker_files() - -# 6. Removes all JS task manager files if it isn't going to be used -if '{{ cookiecutter.js_task_runner}}'.lower() == 'gulp': - remove_grunt_files() -elif '{{ cookiecutter.js_task_runner}}'.lower() == 'grunt': - remove_gulp_files() -else: - remove_gulp_files() - remove_grunt_files() - remove_packageJSON_file() + return value -# 9. Display a warning if use_docker and use_grunt are selected. Grunt isn't -# supported by our docker config atm. -if '{{ cookiecutter.js_task_runner }}'.lower() in ['grunt', 'gulp'] and '{{ cookiecutter.use_docker }}'.lower() == 'y': - print( - "You selected to use docker and a JS task runner. This is NOT supported out of the box for now. You " - "can continue to use the project like you normally would, but you will need to add a " - "js task runner service to your docker configuration manually." +def set_django_secret_key(file_path): + django_secret_key = set_flag( + file_path, + '!!!SET DJANGO_SECRET_KEY!!!', + length=50, + using_digits=True, + using_ascii_letters=True ) + return django_secret_key -# 10. Removes files needed for the GPLv3 licence if it isn't going to be used. -if '{{ cookiecutter.open_source_license}}' != 'GPLv3': - remove_copying_files() + +def set_postgres_user(file_path, + value=None): + postgres_user = set_flag( + file_path, + '!!!SET POSTGRES_USER!!!', + value=value, + length=8, + using_ascii_letters=True + ) + return postgres_user + + +def set_postgres_password(file_path): + postgres_password = set_flag( + file_path, + '!!!SET POSTGRES_PASSWORD!!!', + length=42, + using_digits=True, + using_ascii_letters=True + ) + return postgres_password + + +def initialize_dotenv(postgres_user): + # Initializing `env.example` first. + envexample_file_path = os.path.join(PROJECT_DIR_PATH, 'env.example') + set_django_secret_key(envexample_file_path) + set_postgres_user(envexample_file_path, value=postgres_user) + set_postgres_password(envexample_file_path) + # Renaming `env.example` to `.env`. + dotenv_file_path = os.path.join(PROJECT_DIR_PATH, '.env') + shutil.move(envexample_file_path, dotenv_file_path) + + +def initialize_localyml(postgres_user): + set_postgres_user(os.path.join(PROJECT_DIR_PATH, 'local.yml'), value=postgres_user) + + +def initialize_local_settings(): + set_django_secret_key(os.path.join(PROJECT_DIR_PATH, 'config', 'settings', 'local.py')) + + +def initialize_test_settings(): + set_django_secret_key(os.path.join(PROJECT_DIR_PATH, 'config', 'settings', 'test.py')) + + +def main(): + postgres_user = generate_random_string(length=16, using_ascii_letters=True) + initialize_dotenv(postgres_user) + initialize_localyml(postgres_user) + initialize_local_settings() + initialize_test_settings() + + if '{{ cookiecutter.open_source_license }}' == 'Not open source': + remove_open_source_project_only_files() + elif '{{ cookiecutter.open_source_license}}' != 'GPLv3': + remove_gplv3_files() + + if '{{ cookiecutter.use_pycharm }}'.lower() == 'n': + remove_pycharm_files() + + if '{{ cookiecutter.use_docker }}'.lower() == 'n': + remove_docker_files() + + remove_paas_files() + + if '{{ cookiecutter.js_task_runner}}'.lower() == 'gulp': + remove_grunt_files() + elif '{{ cookiecutter.js_task_runner}}'.lower() == 'grunt': + remove_gulp_files() + else: + remove_gulp_files() + remove_grunt_files() + remove_packagejson_file() + + if '{{ cookiecutter.js_task_runner }}'.lower() in ['grunt', 'gulp'] \ + and '{{ cookiecutter.use_docker }}'.lower() == 'y': + TERMINATOR = "\x1b[0m" + INFO = "\x1b[1;33m [INFO]: " + sys.stdout.write( + INFO + + "Docker and {} JS task runner ".format('{{ cookiecutter.js_task_runner }}'.lower().capitalize()) + + "working together not supported yet. " + "You can continue using the generated project like you normally would, " + "however you would need to add a JS task runner service " + "to your Docker Compose configuration manually." + + TERMINATOR + ) + + if '{{ cookiecutter.use_celery }}'.lower() == 'n': + remove_celery_app() + + +if __name__ == '__main__': + main() diff --git a/hooks/pre_gen_project.py b/hooks/pre_gen_project.py index 91367d9f..a65fedae 100644 --- a/hooks/pre_gen_project.py +++ b/hooks/pre_gen_project.py @@ -1,27 +1,59 @@ +""" +NOTE: + the below code is to be maintained Python 2.x-compatible + as the whole Cookiecutter Django project initialization + can potentially be run in Python 2.x environment. + +TODO: ? restrict Cookiecutter Django project initialization to Python 3.x environments only +""" + project_slug = '{{ cookiecutter.project_slug }}' - if hasattr(project_slug, 'isidentifier'): - assert project_slug.isidentifier(), 'Project slug should be valid Python identifier!' + assert project_slug.isidentifier(), "'{}' project slug is not a valid Python identifier.".format(project_slug) -heroku = '{{ cookiecutter.use_heroku }}'.lower() -docker = '{{ cookiecutter.use_docker }}'.lower() +using_docker = '{{ cookiecutter.use_docker }}'.lower() +if using_docker == 'n': + TERMINATOR = "\x1b[0m" + WARNING = "\x1b[1;33m [WARNING]: " + INFO = "\x1b[1;33m [INFO]: " + HINT = "\x1b[3;33m" + SUCCESS = "\x1b[1;32m [SUCCESS]: " -if docker == 'n': - import sys + import sys - python_major_version = sys.version_info[0] + python_major_version = sys.version_info[0] + if python_major_version == 2: + sys.stdout.write( + WARNING + + "Cookiecutter Django does not support Python 2. " + "Stability is guaranteed with Python 3.6+ only, " + "are you sure you want to proceed (y/n)? " + + TERMINATOR + ) + yes_options, no_options = frozenset(['y']), frozenset(['n']) + while True: + choice = raw_input().lower() + if choice in yes_options: + break + elif choice in no_options: + sys.stdout.write( + INFO + + "Generation process stopped as requested." + + TERMINATOR + ) + sys.exit(1) + else: + sys.stdout.write( + HINT + + "Please respond with {} or {}: ".format( + ', '.join(["'{}'".format(o) for o in yes_options if not o == '']), + ', '.join(["'{}'".format(o) for o in no_options if not o == '']) + ) + + TERMINATOR + ) - if python_major_version == 2: - sys.stdout.write("WARNING: Cookiecutter Django does not support Python 2! Stability is guaranteed with Python 3.6+ only. Are you sure you want to proceed? (y/n)") - - yes_options = set(['y']) - no_options = set(['n', '']) - choice = raw_input().lower() - if choice in no_options: - sys.exit(1) - elif choice in yes_options: - pass - else: - sys.stdout.write("Please respond with %s or %s" - % (', '.join([o for o in yes_options if not o == '']) - , ', '.join([o for o in no_options if not o == '']))) + sys.stdout.write( + SUCCESS + + "Project initialized, keep up the good work!" + + TERMINATOR + ) diff --git a/{{cookiecutter.project_slug}}/config/settings/local.py b/{{cookiecutter.project_slug}}/config/settings/local.py index 67a7074a..c903795c 100644 --- a/{{cookiecutter.project_slug}}/config/settings/local.py +++ b/{{cookiecutter.project_slug}}/config/settings/local.py @@ -24,7 +24,7 @@ TEMPLATES[0]['OPTIONS']['debug'] = DEBUG # ------------------------------------------------------------------------------ # 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!!!') +SECRET_KEY = env('DJANGO_SECRET_KEY', default='!!!SET DJANGO_SECRET_KEY!!!') # Mail settings # ------------------------------------------------------------------------------ diff --git a/{{cookiecutter.project_slug}}/config/settings/test.py b/{{cookiecutter.project_slug}}/config/settings/test.py index d973428d..01a41279 100644 --- a/{{cookiecutter.project_slug}}/config/settings/test.py +++ b/{{cookiecutter.project_slug}}/config/settings/test.py @@ -17,7 +17,7 @@ TEMPLATES[0]['OPTIONS']['debug'] = False # ------------------------------------------------------------------------------ # 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!!!') +SECRET_KEY = env('DJANGO_SECRET_KEY', default='!!!SET DJANGO_SECRET_KEY!!!') # Mail settings # ------------------------------------------------------------------------------ diff --git a/{{cookiecutter.project_slug}}/env.example b/{{cookiecutter.project_slug}}/env.example index 420ab4a5..1d28cb59 100644 --- a/{{cookiecutter.project_slug}}/env.example +++ b/{{cookiecutter.project_slug}}/env.example @@ -1,7 +1,7 @@ # PostgreSQL -POSTGRES_PASSWORD=mysecretpass -POSTGRES_USER=postgresuser +POSTGRES_PASSWORD=!!!SET POSTGRES_PASSWORD!!! +POSTGRES_USER=!!!SET POSTGRES_USER!!! CONN_MAX_AGE= # Domain name, used by caddy @@ -11,7 +11,7 @@ DOMAIN_NAME={{ cookiecutter.domain_name }} # DJANGO_READ_DOT_ENV_FILE=True DJANGO_ADMIN_URL= DJANGO_SETTINGS_MODULE=config.settings.production -DJANGO_SECRET_KEY=CHANGEME!!! +DJANGO_SECRET_KEY=!!!SET DJANGO_SECRET_KEY!!! DJANGO_ALLOWED_HOSTS=.{{ cookiecutter.domain_name }} # AWS Settings diff --git a/{{cookiecutter.project_slug}}/local.yml b/{{cookiecutter.project_slug}}/local.yml index aaf131fa..b030e617 100644 --- a/{{cookiecutter.project_slug}}/local.yml +++ b/{{cookiecutter.project_slug}}/local.yml @@ -15,7 +15,7 @@ services: volumes: - .:/app environment: - - POSTGRES_USER={{cookiecutter.project_slug}} + - POSTGRES_USER=!!!SET POSTGRES_USER!!! - USE_DOCKER=yes ports: - "8000:8000" @@ -29,7 +29,7 @@ services: - postgres_data_local:/var/lib/postgresql/data - postgres_backup_local:/backups environment: - - POSTGRES_USER={{cookiecutter.project_slug}} + - POSTGRES_USER=!!!SET POSTGRES_USER!!! {% if cookiecutter.use_mailhog == 'y' %} mailhog: image: mailhog/mailhog:v1.0.0 From fb83d8d8bd8a05553ec45687e14c3b89bd91f1ae Mon Sep 17 00:00:00 2001 From: David Date: Wed, 7 Feb 2018 20:54:56 +0100 Subject: [PATCH 38/41] Add Debian 9 (Stretch) os dependencies (#1496) --- .../utility/requirements-stretch.apt | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 {{cookiecutter.project_slug}}/utility/requirements-stretch.apt diff --git a/{{cookiecutter.project_slug}}/utility/requirements-stretch.apt b/{{cookiecutter.project_slug}}/utility/requirements-stretch.apt new file mode 100644 index 00000000..a2b3a7e5 --- /dev/null +++ b/{{cookiecutter.project_slug}}/utility/requirements-stretch.apt @@ -0,0 +1,23 @@ +##basic build dependencies of various Django apps for Debian Jessie 9.x +#build-essential metapackage install: make, gcc, g++, +build-essential +#required to translate +gettext +python3-dev + +##shared dependencies of: +##Pillow, pylibmc +zlib1g-dev + +##Postgresql and psycopg2 dependencies +libpq-dev + +##Pillow dependencies +libtiff5-dev +libjpeg62-turbo-dev +libfreetype6-dev +liblcms2-dev +libwebp-dev + +##django-extensions +graphviz-dev From 4a81b8577d94ea11918d6c4e732d476fa544fc2e Mon Sep 17 00:00:00 2001 From: "pyup.io bot" Date: Thu, 8 Feb 2018 21:45:45 +0100 Subject: [PATCH 39/41] Update django-anymail from 1.3 to 1.4 (#1498) --- {{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 001937eb..82620365 100644 --- a/{{cookiecutter.project_slug}}/requirements/production.txt +++ b/{{cookiecutter.project_slug}}/requirements/production.txt @@ -24,7 +24,7 @@ Collectfast==0.6.0 # Email backends for Mailgun, Postmark, SendGrid and more # ------------------------------------------------------- -django-anymail==1.3 +django-anymail==1.4 {% if cookiecutter.use_sentry_for_error_reporting == "y" -%} # Raven is the Sentry client From 7271934268f28ac7296e161c54cc134c12d8dc58 Mon Sep 17 00:00:00 2001 From: "pyup.io bot" Date: Thu, 8 Feb 2018 21:46:03 +0100 Subject: [PATCH 40/41] Update psycopg2 to 2.7.4 (#1497) * Update psycopg2 from 2.7.3.2 to 2.7.4 * Update psycopg2 from 2.7.3.2 to 2.7.4 * Update psycopg2 from 2.7.3.2 to 2.7.4 --- {{cookiecutter.project_slug}}/requirements/base.txt | 2 +- {{cookiecutter.project_slug}}/requirements/production.txt | 2 +- {{cookiecutter.project_slug}}/requirements/test.txt | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/{{cookiecutter.project_slug}}/requirements/base.txt b/{{cookiecutter.project_slug}}/requirements/base.txt index b2595156..3d29fe16 100644 --- a/{{cookiecutter.project_slug}}/requirements/base.txt +++ b/{{cookiecutter.project_slug}}/requirements/base.txt @@ -36,7 +36,7 @@ django-allauth==0.35.0 # from http://www.lfd.uci.edu/~gohlke/pythonlibs/#psycopg {% else %} # Python-PostgreSQL Database Adapter -psycopg2==2.7.3.2 +psycopg2==2.7.4 {%- endif %} # Unicode slugification diff --git a/{{cookiecutter.project_slug}}/requirements/production.txt b/{{cookiecutter.project_slug}}/requirements/production.txt index 82620365..64997ba7 100644 --- a/{{cookiecutter.project_slug}}/requirements/production.txt +++ b/{{cookiecutter.project_slug}}/requirements/production.txt @@ -6,7 +6,7 @@ # Python-PostgreSQL Database Adapter # Assuming Windows is used locally, and *nix -- in production. # ------------------------------------------------------------ -psycopg2==2.7.3.2 +psycopg2==2.7.4 {%- endif %} # WSGI Handler diff --git a/{{cookiecutter.project_slug}}/requirements/test.txt b/{{cookiecutter.project_slug}}/requirements/test.txt index 5980a30e..8e8969c7 100644 --- a/{{cookiecutter.project_slug}}/requirements/test.txt +++ b/{{cookiecutter.project_slug}}/requirements/test.txt @@ -4,7 +4,7 @@ {% if cookiecutter.windows == 'y' -%} # Python-PostgreSQL Database Adapter # If using Win for dev, this assumes Unix in test/prod -psycopg2==2.7.3.2 +psycopg2==2.7.4 {%- endif %} coverage==4.5 From dd756e432dc35fa5b0157466b9ead6a6f5240065 Mon Sep 17 00:00:00 2001 From: pyup-bot Date: Thu, 8 Feb 2018 15:26:11 -0800 Subject: [PATCH 41/41] Update boto3 from 1.5.24 to 1.5.25 --- {{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 64997ba7..952ba4bd 100644 --- a/{{cookiecutter.project_slug}}/requirements/production.txt +++ b/{{cookiecutter.project_slug}}/requirements/production.txt @@ -16,7 +16,7 @@ gunicorn==19.7.1 # Static and Media Storage # ------------------------------------------------ -boto3==1.5.24 +boto3==1.5.25 django-storages==1.6.5 {% if cookiecutter.use_whitenoise != 'y' -%} Collectfast==0.6.0