From 75a0699848dd752c412e750da9fefe4006ba8454 Mon Sep 17 00:00:00 2001 From: "pyup.io bot" Date: Thu, 21 Jun 2018 05:00:47 +0200 Subject: [PATCH 01/56] Update pytest to 3.6.2 (#1690) This PR updates [pytest](https://pypi.org/project/pytest) from **3.6.1** to **3.6.2**. *The bot wasn't able to find a changelog for this release. [Got an idea?](https://github.com/pyupio/changelogs/issues/new)*
Links - PyPI: https://pypi.org/project/pytest - Changelog: https://pyup.io/changelogs/pytest/ - Repo: https://github.com/pytest-dev/pytest/issues - Homepage: http://pytest.org
--- requirements.txt | 2 +- {{cookiecutter.project_slug}}/requirements/local.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/requirements.txt b/requirements.txt index 9f378fda..77770fa9 100644 --- a/requirements.txt +++ b/requirements.txt @@ -9,5 +9,5 @@ flake8==3.5.0 # Testing # ------------------------------------------------------------------------------ tox==3.0.0 -pytest==3.6.1 +pytest==3.6.2 pytest-cookies==0.3.0 diff --git a/{{cookiecutter.project_slug}}/requirements/local.txt b/{{cookiecutter.project_slug}}/requirements/local.txt index a72a5418..14903b1a 100644 --- a/{{cookiecutter.project_slug}}/requirements/local.txt +++ b/{{cookiecutter.project_slug}}/requirements/local.txt @@ -11,7 +11,7 @@ psycopg2-binary==2.7.5 # https://github.com/psycopg/psycopg2 # Testing # ------------------------------------------------------------------------------ -pytest==3.6.1 # https://github.com/pytest-dev/pytest +pytest==3.6.2 # https://github.com/pytest-dev/pytest pytest-sugar==0.9.1 # https://github.com/Frozenball/pytest-sugar # Code quality From 5309fbf5e7135087f61f58bb2a940d92596e371b Mon Sep 17 00:00:00 2001 From: Wan Liuyang Date: Thu, 21 Jun 2018 14:53:04 +0800 Subject: [PATCH 02/56] Upgrade celery to 4.2 (#1446) * Update celery to 4.1.0 * Re-add endif closing block * Update local.py * Update base.txt * Update local.py --- {{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 a5399ea5..5e8f7846 100644 --- a/{{cookiecutter.project_slug}}/requirements/base.txt +++ b/{{cookiecutter.project_slug}}/requirements/base.txt @@ -10,7 +10,7 @@ whitenoise==3.3.1 # https://github.com/evansd/whitenoise {%- endif %} redis>=2.10.5 # https://github.com/antirez/redis {%- if cookiecutter.use_celery == "y" %} -celery==3.1.26.post2 # pyup: <4.0 # https://github.com/celery/celery +celery==4.2.0 # pyup: <5.0 # https://github.com/celery/celery {%- endif %} # Django From 07060eaecc07c444470b91b0915b63b6f4fc88f7 Mon Sep 17 00:00:00 2001 From: Nikita Shupeyko Date: Thu, 21 Jun 2018 19:38:48 +0000 Subject: [PATCH 03/56] Extend & enhance Celery configuration (#1679) * CELERY_TASK_TIME_LIMIT * CELERY_TASK_SOFT_TIME_LIMIT * CELERY_ALWAYS_EAGER -> CELERY_TASK_ALWAYS_EAGER * CELERY_EAGER_PROPAGATES = CELERY_TASK_ALWAYS_EAGER Addresses https://github.com/pydanny/cookiecutter-django/pull/1446/files#r167238808 * CELERY_RESULT_BACKEND = CELERY_BROKER_URL always * CELERY_TIMEZONE = TIME_ZONE * CELERY_TASK_EAGER_PROPAGATES = True * Name task limit settings appropriately CELERY_TASK_TIME_LIMIT -> CELERYD_TASK_TIME_LIMIT, CELERY_TASK_SOFT_TIME_LIMIT -> CELERYD_TASK_SOFT_TIME_LIMIT --- .../config/settings/base.py | 16 +++++++++++----- .../config/settings/local.py | 6 ++++-- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/{{cookiecutter.project_slug}}/config/settings/base.py b/{{cookiecutter.project_slug}}/config/settings/base.py index 26bbd479..e4ab2884 100644 --- a/{{cookiecutter.project_slug}}/config/settings/base.py +++ b/{{cookiecutter.project_slug}}/config/settings/base.py @@ -229,19 +229,25 @@ MANAGERS = ADMINS # Celery # ------------------------------------------------------------------------------ INSTALLED_APPS += ['{{cookiecutter.project_slug}}.taskapp.celery.CeleryAppConfig'] +if USE_TZ: + # http://docs.celeryproject.org/en/latest/userguide/configuration.html#std:setting-timezone + CELERY_TIMEZONE = TIME_ZONE # http://docs.celeryproject.org/en/latest/userguide/configuration.html#std:setting-broker_url -CELERY_BROKER_URL = env('CELERY_BROKER_URL', default='django://') +CELERY_BROKER_URL = env('CELERY_BROKER_URL') # http://docs.celeryproject.org/en/latest/userguide/configuration.html#std:setting-result_backend -if CELERY_BROKER_URL == 'django://': - CELERY_RESULT_BACKEND = 'redis://' -else: - CELERY_RESULT_BACKEND = CELERY_BROKER_URL +CELERY_RESULT_BACKEND = CELERY_BROKER_URL # http://docs.celeryproject.org/en/latest/userguide/configuration.html#std:setting-accept_content CELERY_ACCEPT_CONTENT = ['json'] # http://docs.celeryproject.org/en/latest/userguide/configuration.html#std:setting-task_serializer CELERY_TASK_SERIALIZER = 'json' # http://docs.celeryproject.org/en/latest/userguide/configuration.html#std:setting-result_serializer CELERY_RESULT_SERIALIZER = 'json' +# http://docs.celeryproject.org/en/latest/userguide/configuration.html#task-time-limit +# TODO: set to whatever value is adequate in your circumstances +CELERYD_TASK_TIME_LIMIT = 5 * 60 +# http://docs.celeryproject.org/en/latest/userguide/configuration.html#task-soft-time-limit +# TODO: set to whatever value is adequate in your circumstances +CELERYD_TASK_SOFT_TIME_LIMIT = 60 {%- endif %} # django-allauth diff --git a/{{cookiecutter.project_slug}}/config/settings/local.py b/{{cookiecutter.project_slug}}/config/settings/local.py index ac11eda5..741f324a 100644 --- a/{{cookiecutter.project_slug}}/config/settings/local.py +++ b/{{cookiecutter.project_slug}}/config/settings/local.py @@ -76,8 +76,10 @@ INSTALLED_APPS += ['django_extensions'] # noqa F405 # Celery # ------------------------------------------------------------------------------ -# http://docs.celeryproject.org/en/latest/userguide/configuration.html#std:setting-task_always_eager -CELERY_ALWAYS_EAGER = True +# http://docs.celeryproject.org/en/latest/userguide/configuration.html#task-always-eager +CELERY_TASK_ALWAYS_EAGER = True +# http://docs.celeryproject.org/en/latest/userguide/configuration.html#task-eager-propagates +CELERY_TASK_EAGER_PROPAGATES = True {%- endif %} # Your stuff... From 83b5f00ac55af641152e99c11b806ac62149dcfa Mon Sep 17 00:00:00 2001 From: Denis Orehovsky Date: Thu, 21 Jun 2018 22:39:19 +0300 Subject: [PATCH 04/56] Add celery prefix for configuration (#1676) * Add celery prefix for configuration * Update CONTRIBUTORS.rst --- CONTRIBUTORS.rst | 2 ++ .../{{cookiecutter.project_slug}}/taskapp/celery.py | 4 +++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CONTRIBUTORS.rst b/CONTRIBUTORS.rst index 0f6761ed..55ae6d72 100644 --- a/CONTRIBUTORS.rst +++ b/CONTRIBUTORS.rst @@ -87,6 +87,7 @@ Listed in alphabetical order. David Díaz `@ddiazpinto`_ @DavidDiazPinto Davur Clementsen `@dsclementsen`_ @davur Delio Castillo `@jangeador`_ @jangeador + Denis Orehovsky `@apirobot`_ Dónal Adams `@epileptic-fish`_ Dong Huynh `@trungdong`_ Emanuel Calso `@bloodpet`_ @bloodpet @@ -172,6 +173,7 @@ Listed in alphabetical order. .. _@amjith: https://github.com/amjith .. _@andor-pierdelacabeza: https://github.com/andor-pierdelacabeza .. _@antoniablair: https://github.com/antoniablair +.. _@apirobot: https://github.com/apirobot .. _@archinal: https://github.com/archinal .. _@areski: https://github.com/areski .. _@arruda: https://github.com/arruda diff --git a/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/taskapp/celery.py b/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/taskapp/celery.py index ed5c7176..b3f0a388 100644 --- a/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/taskapp/celery.py +++ b/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/taskapp/celery.py @@ -20,7 +20,9 @@ class CeleryAppConfig(AppConfig): def ready(self): # Using a string here means the worker will not have to # pickle the object when using Windows. - app.config_from_object('django.conf:settings') + # - namespace='CELERY' means all celery-related configuration keys + # should have a `CELERY_` prefix. + app.config_from_object('django.conf:settings', namespace='CELERY') installed_apps = [app_config.name for app_config in apps.get_app_configs()] app.autodiscover_tasks(lambda: installed_apps, force=True) From ee2bb3f2efef6add9a598597354ef5b3d3541f0b Mon Sep 17 00:00:00 2001 From: "pyup.io bot" Date: Fri, 22 Jun 2018 02:50:02 +0200 Subject: [PATCH 05/56] Update pytest-django to 3.3.2 (#1692) This PR updates [pytest-django](https://pypi.org/project/pytest-django) from **3.3.0** to **3.3.2**.
Changelog ### 3.3.1 ``` ------------------ Bug fixes ^^^^^^^^^ * Fixed test for classmethod with Django TestCases again (618, introduced in 598 (3.3.0)). Compatibility ^^^^^^^^^^^^^ * Support Django 2.1 (no changes necessary) (614). ```
Links - PyPI: https://pypi.org/project/pytest-django - Changelog: https://pyup.io/changelogs/pytest-django/ - Docs: https://pytest-django.readthedocs.io/
--- {{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 14903b1a..27655b3f 100644 --- a/{{cookiecutter.project_slug}}/requirements/local.txt +++ b/{{cookiecutter.project_slug}}/requirements/local.txt @@ -27,4 +27,4 @@ django-test-plus==1.1.0 # https://github.com/revsys/django-test-plus django-debug-toolbar==1.9.1 # https://github.com/jazzband/django-debug-toolbar django-extensions==2.0.7 # https://github.com/django-extensions/django-extensions django-coverage-plugin==1.5.0 # https://github.com/nedbat/django_coverage_plugin -pytest-django==3.3.0 # https://github.com/pytest-dev/pytest-django +pytest-django==3.3.2 # https://github.com/pytest-dev/pytest-django From 0d1cfe548c933c489416d3f81d07cf2e8e0a10a5 Mon Sep 17 00:00:00 2001 From: Denis Date: Sun, 24 Jun 2018 02:34:08 +0300 Subject: [PATCH 06/56] Make 'duplicate_username' message translatable Added ugettext_lazy and used it on the 'duplicate_username' message --- .../{{cookiecutter.project_slug}}/users/admin.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/users/admin.py b/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/users/admin.py index 8da8f86a..9c9fd840 100644 --- a/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/users/admin.py +++ b/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/users/admin.py @@ -3,7 +3,7 @@ from django.contrib import admin from django.contrib.auth.admin import UserAdmin as AuthUserAdmin from django.contrib.auth.forms import UserChangeForm, UserCreationForm from .models import User - +from django.utils.translation import ugettext_lazy as _ class MyUserChangeForm(UserChangeForm): @@ -14,7 +14,7 @@ class MyUserChangeForm(UserChangeForm): class MyUserCreationForm(UserCreationForm): error_message = UserCreationForm.error_messages.update( - {"duplicate_username": "This username has already been taken."} + {"duplicate_username": _("This username has already been taken.")} ) class Meta(UserCreationForm.Meta): From 548a92a9390d8c56b4eb3d7b14f7ed246cbd89e5 Mon Sep 17 00:00:00 2001 From: Denis Date: Sun, 24 Jun 2018 02:36:43 +0300 Subject: [PATCH 07/56] Update CONTRIBUTORS.rst --- CONTRIBUTORS.rst | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CONTRIBUTORS.rst b/CONTRIBUTORS.rst index 55ae6d72..6b3f0066 100644 --- a/CONTRIBUTORS.rst +++ b/CONTRIBUTORS.rst @@ -162,6 +162,7 @@ Listed in alphabetical order. Will Farley `@goldhand`_ @g01dhand William Archinal `@archinal`_ Yaroslav Halchenko + Denis Bobrov `@delneg`_ ========================== ============================ ============== .. _@a7p: https://github.com/a7p @@ -265,7 +266,7 @@ Listed in alphabetical order. .. _@brentpayne: https://github.com/brentpayne .. _@afrowave: https://github.com/afrowave .. _@pchiquet: https://github.com/pchiquet - +.. _@delneg: https://github.com/delneg Special Thanks ~~~~~~~~~~~~~~ From 2a7ab8be2f01fed4a9c9b7d8fdcae6d4e6daf658 Mon Sep 17 00:00:00 2001 From: Denis Date: Mon, 25 Jun 2018 21:08:33 +0300 Subject: [PATCH 08/56] Try to fix flake8 --- .../{{cookiecutter.project_slug}}/users/admin.py | 1 + 1 file changed, 1 insertion(+) diff --git a/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/users/admin.py b/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/users/admin.py index 9c9fd840..6b5a60c7 100644 --- a/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/users/admin.py +++ b/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/users/admin.py @@ -5,6 +5,7 @@ from django.contrib.auth.forms import UserChangeForm, UserCreationForm from .models import User from django.utils.translation import ugettext_lazy as _ + class MyUserChangeForm(UserChangeForm): class Meta(UserChangeForm.Meta): From eb0297aeb32491de14fa2ae8fe2b6e85191c4198 Mon Sep 17 00:00:00 2001 From: "pyup.io bot" Date: Tue, 26 Jun 2018 09:53:36 +0200 Subject: [PATCH 09/56] Update django-environ from 0.4.4 to 0.4.5 (#1695) --- {{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 5e8f7846..b553bb83 100644 --- a/{{cookiecutter.project_slug}}/requirements/base.txt +++ b/{{cookiecutter.project_slug}}/requirements/base.txt @@ -16,7 +16,7 @@ celery==4.2.0 # pyup: <5.0 # https://github.com/celery/celery # Django # ------------------------------------------------------------------------------ django==2.0.6 # pyup: < 2.1 # https://www.djangoproject.com/ -django-environ==0.4.4 # https://github.com/joke2k/django-environ +django-environ==0.4.5 # https://github.com/joke2k/django-environ django-model-utils==3.1.2 # https://github.com/jazzband/django-model-utils django-allauth==0.36.0 # https://github.com/pennersr/django-allauth django-crispy-forms==1.7.2 # https://github.com/django-crispy-forms/django-crispy-forms From 275c13292c4d35a808fcb50ae57a05795395350a Mon Sep 17 00:00:00 2001 From: Nikita Shupeyko Date: Wed, 27 Jun 2018 19:33:21 +0300 Subject: [PATCH 10/56] Integrate Flower with Docker Compose setup (#1655) * Integrate Flower with Docker Compose setup locally * Remove alien worker celeryd option * Move Flower COPY section below the worker's * Remove set -o pipefail command from Flower start script * Flower client authentication * Override flower service image name * Move flower service to the end of local.yml * Install flower==0.9.2 in all environments * Introduce production flower service * Fix local flower start script * Document Flower integration * Prettify *.django envs Rationale: consistency. * Reference local environment Flower docs from the production's * 'two more services' -> 'three more services' --- README.rst | 3 +- docs/deployment-with-docker.rst | 7 ++- docs/developing-locally-docker.rst | 17 ++++++ hooks/post_gen_project.py | 58 ++++++++++++++++--- .../.envs/.local/.django | 8 +++ .../.envs/.production/.django | 8 +++ .../compose/local/django/Dockerfile | 4 ++ .../compose/local/django/celery/flower/start | 10 ++++ .../compose/production/django/Dockerfile | 4 ++ .../production/django/celery/flower/start | 10 ++++ {{cookiecutter.project_slug}}/local.yml | 7 +++ {{cookiecutter.project_slug}}/production.yml | 7 +++ .../requirements/base.txt | 3 + 13 files changed, 134 insertions(+), 12 deletions(-) create mode 100644 {{cookiecutter.project_slug}}/compose/local/django/celery/flower/start create mode 100644 {{cookiecutter.project_slug}}/compose/production/django/celery/flower/start diff --git a/README.rst b/README.rst index 0eaea519..a69712d0 100644 --- a/README.rst +++ b/README.rst @@ -65,7 +65,7 @@ Optional Integrations *These features can be enabled during initial project setup.* * Serve static files from Amazon S3 or Whitenoise_ -* Configuration for Celery_ +* Configuration for Celery_ and Flower_ (the latter in Docker setup only) * Integration with MailHog_ for local email testing * Integration with Sentry_ for error logging @@ -78,6 +78,7 @@ Optional Integrations .. _Mailgun: http://www.mailgun.com/ .. _Whitenoise: https://whitenoise.readthedocs.io/ .. _Celery: http://www.celeryproject.org/ +.. _Flower: https://github.com/mher/flower .. _Anymail: https://github.com/anymail/django-anymail .. _MailHog: https://github.com/mailhog/MailHog .. _Sentry: https://sentry.io/welcome/ diff --git a/docs/deployment-with-docker.rst b/docs/deployment-with-docker.rst index 42798aae..0115e3a4 100644 --- a/docs/deployment-with-docker.rst +++ b/docs/deployment-with-docker.rst @@ -21,10 +21,13 @@ Before you begin, check out the ``production.yml`` file in the root of this proj * ``redis``: Redis instance for caching; * ``caddy``: Caddy web server with HTTPS on by default. -Provided you have opted for Celery (via setting ``use_celery`` to ``y``) there are two more services: +Provided you have opted for Celery (via setting ``use_celery`` to ``y``) there are three more services: * ``celeryworker`` running a Celery worker process; -* ``celerybeat`` running a Celery beat process. +* ``celerybeat`` running a Celery beat process; +* ``flower`` running Flower_ (for more info, check out :ref:`CeleryFlower` instructions for local environment). + +.. _`Flower`: https://github.com/mher/flower Configuring the Stack diff --git a/docs/developing-locally-docker.rst b/docs/developing-locally-docker.rst index 207f0ea2..c6af1d96 100644 --- a/docs/developing-locally-docker.rst +++ b/docs/developing-locally-docker.rst @@ -170,3 +170,20 @@ When developing locally you can go with MailHog_ for email testing provided ``us #. open up ``http://127.0.0.1:8025``. .. _Mailhog: https://github.com/mailhog/MailHog/ + + +.. _`CeleryFlower`: + +Celery Flower +~~~~~~~~~~~~~ + +`Flower`_ is a "real-time monitor and web admin for Celery distributed task queue". + +Prerequisites: + +* ``use_docker`` was set to ``y`` on project initialization; +* ``use_celery`` was set to ``y`` on project initialization. + +By default, it's enabled both in local and production environments (``local.yml`` and ``production.yml`` Docker Compose configs, respectively) through a ``flower`` service. For added security, ``flower`` requires its clients to provide authentication credentials specified as the corresponding environments' ``.envs/.local/.django`` and ``.envs/.production/.django`` ``CELERY_FLOWER_USER`` and ``CELERY_FLOWER_PASSWORD`` environment variables. Check out ``localhost:5555`` and see for yourself. + +.. _`Flower`: https://github.com/mher/flower diff --git a/hooks/post_gen_project.py b/hooks/post_gen_project.py index 6b48471e..9118f6c9 100644 --- a/hooks/post_gen_project.py +++ b/hooks/post_gen_project.py @@ -162,8 +162,12 @@ def set_django_admin_url(file_path): return django_admin_url +def generate_random_user(): + return generate_random_string(length=32, using_ascii_letters=True) + + def generate_postgres_user(debug=False): - return DEBUG_VALUE if debug else generate_random_string(length=32, using_ascii_letters=True) + return DEBUG_VALUE if debug else generate_random_user() def set_postgres_user(file_path, value): @@ -187,25 +191,56 @@ def set_postgres_password(file_path, value=None): return postgres_password +def set_celery_flower_user(file_path, value): + celery_flower_user = set_flag( + file_path, + "!!!SET CELERY_FLOWER_USER!!!", + value=value, + ) + return celery_flower_user + + +def set_celery_flower_password(file_path, value=None): + celery_flower_password = set_flag( + file_path, + "!!!SET CELERY_FLOWER_PASSWORD!!!", + value=value, + length=64, + using_digits=True, + using_ascii_letters=True, + ) + return celery_flower_password + + def append_to_gitignore_file(s): with open(".gitignore", "a") as gitignore_file: gitignore_file.write(s) gitignore_file.write(os.linesep) -def set_flags_in_envs(postgres_user, debug=False): - local_postgres_envs_path = os.path.join(".envs", ".local", ".postgres") - set_postgres_user(local_postgres_envs_path, value=postgres_user) - set_postgres_password(local_postgres_envs_path, value=DEBUG_VALUE if debug else None) - +def set_flags_in_envs( + postgres_user, + celery_flower_user, + debug=False, +): + local_django_envs_path = os.path.join(".envs", ".local", ".django") production_django_envs_path = os.path.join(".envs", ".production", ".django") + local_postgres_envs_path = os.path.join(".envs", ".local", ".postgres") + production_postgres_envs_path = os.path.join(".envs", ".production", ".postgres") + set_django_secret_key(production_django_envs_path) set_django_admin_url(production_django_envs_path) - production_postgres_envs_path = os.path.join(".envs", ".production", ".postgres") + set_postgres_user(local_postgres_envs_path, value=postgres_user) + set_postgres_password(local_postgres_envs_path, value=DEBUG_VALUE if debug else None) set_postgres_user(production_postgres_envs_path, value=postgres_user) set_postgres_password(production_postgres_envs_path, value=DEBUG_VALUE if debug else None) + set_celery_flower_user(local_django_envs_path, value=celery_flower_user) + set_celery_flower_password(local_django_envs_path, value=DEBUG_VALUE if debug else None) + set_celery_flower_user(production_django_envs_path, value=celery_flower_user) + set_celery_flower_password(production_django_envs_path, value=DEBUG_VALUE if debug else None) + def set_flags_in_settings_files(): set_django_secret_key(os.path.join("config", "settings", "local.py")) @@ -223,8 +258,13 @@ def remove_celery_compose_dirs(): def main(): - postgres_user = generate_postgres_user(debug="{{ cookiecutter.debug }}".lower() == "y") - set_flags_in_envs(postgres_user, debug="{{ cookiecutter.debug }}".lower() == "y") + debug = "{{ cookiecutter.debug }}".lower() == "y" + + set_flags_in_envs( + DEBUG_VALUE if debug else generate_random_user(), + DEBUG_VALUE if debug else generate_random_user(), + debug=debug, + ) set_flags_in_settings_files() if "{{ cookiecutter.open_source_license }}" == "Not open source": diff --git a/{{cookiecutter.project_slug}}/.envs/.local/.django b/{{cookiecutter.project_slug}}/.envs/.local/.django index 8aa9a994..d94a17e5 100644 --- a/{{cookiecutter.project_slug}}/.envs/.local/.django +++ b/{{cookiecutter.project_slug}}/.envs/.local/.django @@ -5,3 +5,11 @@ USE_DOCKER=yes # Redis # ------------------------------------------------------------------------------ REDIS_URL=redis://redis:6379/0 +{% if cookiecutter.use_celery == 'y' %} +# Celery +# ------------------------------------------------------------------------------ + +# Flower +CELERY_FLOWER_USER=!!!SET CELERY_FLOWER_USER!!! +CELERY_FLOWER_PASSWORD=!!!SET CELERY_FLOWER_PASSWORD!!! +{% endif %} diff --git a/{{cookiecutter.project_slug}}/.envs/.production/.django b/{{cookiecutter.project_slug}}/.envs/.production/.django index 5cb90897..4175f894 100644 --- a/{{cookiecutter.project_slug}}/.envs/.production/.django +++ b/{{cookiecutter.project_slug}}/.envs/.production/.django @@ -43,3 +43,11 @@ SENTRY_DSN= # Redis # ------------------------------------------------------------------------------ REDIS_URL=redis://redis:6379/0 +{% if cookiecutter.use_celery == 'y' %} +# Celery +# ------------------------------------------------------------------------------ + +# Flower +CELERY_FLOWER_USER=!!!SET CELERY_FLOWER_USER!!! +CELERY_FLOWER_PASSWORD=!!!SET CELERY_FLOWER_PASSWORD!!! +{% endif %} diff --git a/{{cookiecutter.project_slug}}/compose/local/django/Dockerfile b/{{cookiecutter.project_slug}}/compose/local/django/Dockerfile index 27424954..e2e9e5f3 100644 --- a/{{cookiecutter.project_slug}}/compose/local/django/Dockerfile +++ b/{{cookiecutter.project_slug}}/compose/local/django/Dockerfile @@ -34,6 +34,10 @@ RUN chmod +x /start-celeryworker COPY ./compose/local/django/celery/beat/start /start-celerybeat RUN sed -i 's/\r//' /start-celerybeat RUN chmod +x /start-celerybeat + +COPY ./compose/local/django/celery/flower/start /start-flower +RUN sed -i 's/\r//' /start-flower +RUN chmod +x /start-flower {% endif %} WORKDIR /app diff --git a/{{cookiecutter.project_slug}}/compose/local/django/celery/flower/start b/{{cookiecutter.project_slug}}/compose/local/django/celery/flower/start new file mode 100644 index 00000000..f0abae7e --- /dev/null +++ b/{{cookiecutter.project_slug}}/compose/local/django/celery/flower/start @@ -0,0 +1,10 @@ +#!/bin/sh + +set -o errexit +set -o nounset + + +celery flower \ + --app={{cookiecutter.project_slug}}.taskapp \ + --broker="${CELERY_BROKER_URL}" \ + --basic_auth="${CELERY_FLOWER_USER}:${CELERY_FLOWER_PASSWORD}" diff --git a/{{cookiecutter.project_slug}}/compose/production/django/Dockerfile b/{{cookiecutter.project_slug}}/compose/production/django/Dockerfile index b204a481..68d72327 100644 --- a/{{cookiecutter.project_slug}}/compose/production/django/Dockerfile +++ b/{{cookiecutter.project_slug}}/compose/production/django/Dockerfile @@ -38,6 +38,10 @@ COPY ./compose/production/django/celery/beat/start /start-celerybeat RUN sed -i 's/\r//' /start-celerybeat RUN chmod +x /start-celerybeat RUN chown django /start-celerybeat + +COPY ./compose/production/django/celery/flower/start /start-flower +RUN sed -i 's/\r//' /start-flower +RUN chmod +x /start-flower {% endif %} COPY . /app diff --git a/{{cookiecutter.project_slug}}/compose/production/django/celery/flower/start b/{{cookiecutter.project_slug}}/compose/production/django/celery/flower/start new file mode 100644 index 00000000..f0abae7e --- /dev/null +++ b/{{cookiecutter.project_slug}}/compose/production/django/celery/flower/start @@ -0,0 +1,10 @@ +#!/bin/sh + +set -o errexit +set -o nounset + + +celery flower \ + --app={{cookiecutter.project_slug}}.taskapp \ + --broker="${CELERY_BROKER_URL}" \ + --basic_auth="${CELERY_FLOWER_USER}:${CELERY_FLOWER_PASSWORD}" diff --git a/{{cookiecutter.project_slug}}/local.yml b/{{cookiecutter.project_slug}}/local.yml index 5ad26dfd..ac13d185 100644 --- a/{{cookiecutter.project_slug}}/local.yml +++ b/{{cookiecutter.project_slug}}/local.yml @@ -71,4 +71,11 @@ services: ports: [] command: /start-celerybeat + flower: + <<: *django + image: {{ cookiecutter.project_slug }}_local_flower + ports: + - "5555:5555" + command: /start-flower + {%- endif %} diff --git a/{{cookiecutter.project_slug}}/production.yml b/{{cookiecutter.project_slug}}/production.yml index 4ee178d8..9415db61 100644 --- a/{{cookiecutter.project_slug}}/production.yml +++ b/{{cookiecutter.project_slug}}/production.yml @@ -59,4 +59,11 @@ services: image: {{ cookiecutter.project_slug }}_production_celerybeat command: /start-celerybeat + flower: + <<: *django + image: {{ cookiecutter.project_slug }}_production_flower + ports: + - "5555:5555" + command: /start-flower + {%- endif %} diff --git a/{{cookiecutter.project_slug}}/requirements/base.txt b/{{cookiecutter.project_slug}}/requirements/base.txt index b553bb83..5dd5d99e 100644 --- a/{{cookiecutter.project_slug}}/requirements/base.txt +++ b/{{cookiecutter.project_slug}}/requirements/base.txt @@ -11,6 +11,9 @@ whitenoise==3.3.1 # https://github.com/evansd/whitenoise redis>=2.10.5 # https://github.com/antirez/redis {%- if cookiecutter.use_celery == "y" %} celery==4.2.0 # pyup: <5.0 # https://github.com/celery/celery +{%- if cookiecutter.use_docker == 'y' %} +flower==0.9.2 # https://github.com/mher/flower +{%- endif %} {%- endif %} # Django From 8ad7adb11ae276bc8452ba32e5fc7cb53d880b81 Mon Sep 17 00:00:00 2001 From: Nikita Shupeyko Date: Wed, 27 Jun 2018 19:33:38 +0300 Subject: [PATCH 11/56] Re-write users app tests in pytest style & perform minor refactoring (#1680) --- .../{tests___all.xml => pytest___.xml} | 19 ++--- ...___module__users.xml => pytest__users.xml} | 19 ++--- .../tests___class__TestUser.xml | 30 ------- .../tests___file__test_models.xml | 30 ------- ...ests___specific__test_get_absolute_url.xml | 30 ------- .../requirements/local.txt | 1 - .../{{cookiecutter.project_slug}}/conftest.py | 20 +++++ .../users/adapters.py | 9 ++- .../users/admin.py | 43 +++------- .../users/apps.py | 7 +- .../users/forms.py | 31 ++++++++ .../users/models.py | 7 +- .../users/tests/factories.py | 32 ++++++-- .../users/tests/test_admin.py | 44 ----------- .../users/tests/test_forms.py | 41 ++++++++++ .../users/tests/test_models.py | 20 ++--- .../users/tests/test_urls.py | 52 +++++------- .../users/tests/test_views.py | 79 ++++++++++--------- .../users/urls.py | 19 ++--- .../users/views.py | 57 +++++++------ 20 files changed, 258 insertions(+), 332 deletions(-) rename {{cookiecutter.project_slug}}/.idea/runConfigurations/{tests___all.xml => pytest___.xml} (52%) rename {{cookiecutter.project_slug}}/.idea/runConfigurations/{tests___module__users.xml => pytest__users.xml} (50%) delete mode 100644 {{cookiecutter.project_slug}}/.idea/runConfigurations/tests___class__TestUser.xml delete mode 100644 {{cookiecutter.project_slug}}/.idea/runConfigurations/tests___file__test_models.xml delete mode 100644 {{cookiecutter.project_slug}}/.idea/runConfigurations/tests___specific__test_get_absolute_url.xml create mode 100644 {{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/conftest.py create mode 100644 {{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/users/forms.py delete mode 100644 {{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/users/tests/test_admin.py create mode 100644 {{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/users/tests/test_forms.py diff --git a/{{cookiecutter.project_slug}}/.idea/runConfigurations/tests___all.xml b/{{cookiecutter.project_slug}}/.idea/runConfigurations/pytest___.xml similarity index 52% rename from {{cookiecutter.project_slug}}/.idea/runConfigurations/tests___all.xml rename to {{cookiecutter.project_slug}}/.idea/runConfigurations/pytest___.xml index be70ffcd..08f76c45 100644 --- a/{{cookiecutter.project_slug}}/.idea/runConfigurations/tests___all.xml +++ b/{{cookiecutter.project_slug}}/.idea/runConfigurations/pytest___.xml @@ -1,18 +1,14 @@ - + - + \ No newline at end of file diff --git a/{{cookiecutter.project_slug}}/.idea/runConfigurations/tests___module__users.xml b/{{cookiecutter.project_slug}}/.idea/runConfigurations/pytest__users.xml similarity index 50% rename from {{cookiecutter.project_slug}}/.idea/runConfigurations/tests___module__users.xml rename to {{cookiecutter.project_slug}}/.idea/runConfigurations/pytest__users.xml index d838b5da..574361fe 100644 --- a/{{cookiecutter.project_slug}}/.idea/runConfigurations/tests___module__users.xml +++ b/{{cookiecutter.project_slug}}/.idea/runConfigurations/pytest__users.xml @@ -1,18 +1,14 @@ - + - + \ No newline at end of file diff --git a/{{cookiecutter.project_slug}}/.idea/runConfigurations/tests___class__TestUser.xml b/{{cookiecutter.project_slug}}/.idea/runConfigurations/tests___class__TestUser.xml deleted file mode 100644 index 204de9dd..00000000 --- a/{{cookiecutter.project_slug}}/.idea/runConfigurations/tests___class__TestUser.xml +++ /dev/null @@ -1,30 +0,0 @@ - - - - - diff --git a/{{cookiecutter.project_slug}}/.idea/runConfigurations/tests___file__test_models.xml b/{{cookiecutter.project_slug}}/.idea/runConfigurations/tests___file__test_models.xml deleted file mode 100644 index ddb6d3d6..00000000 --- a/{{cookiecutter.project_slug}}/.idea/runConfigurations/tests___file__test_models.xml +++ /dev/null @@ -1,30 +0,0 @@ - - - - - diff --git a/{{cookiecutter.project_slug}}/.idea/runConfigurations/tests___specific__test_get_absolute_url.xml b/{{cookiecutter.project_slug}}/.idea/runConfigurations/tests___specific__test_get_absolute_url.xml deleted file mode 100644 index c391058f..00000000 --- a/{{cookiecutter.project_slug}}/.idea/runConfigurations/tests___specific__test_get_absolute_url.xml +++ /dev/null @@ -1,30 +0,0 @@ - - - - - diff --git a/{{cookiecutter.project_slug}}/requirements/local.txt b/{{cookiecutter.project_slug}}/requirements/local.txt index 27655b3f..63799d99 100644 --- a/{{cookiecutter.project_slug}}/requirements/local.txt +++ b/{{cookiecutter.project_slug}}/requirements/local.txt @@ -22,7 +22,6 @@ coverage==4.5.1 # https://github.com/nedbat/coveragepy # Django # ------------------------------------------------------------------------------ factory-boy==2.11.1 # https://github.com/FactoryBoy/factory_boy -django-test-plus==1.1.0 # https://github.com/revsys/django-test-plus django-debug-toolbar==1.9.1 # https://github.com/jazzband/django-debug-toolbar django-extensions==2.0.7 # https://github.com/django-extensions/django-extensions diff --git a/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/conftest.py b/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/conftest.py new file mode 100644 index 00000000..aae11d26 --- /dev/null +++ b/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/conftest.py @@ -0,0 +1,20 @@ +import pytest +from django.conf import settings +from django.test import RequestFactory + +from {{ cookiecutter.project_slug }}.users.tests.factories import UserFactory + + +@pytest.fixture(autouse=True) +def media_storage(settings, tmpdir): + settings.MEDIA_ROOT = tmpdir.strpath + + +@pytest.fixture +def user() -> settings.AUTH_USER_MODEL: + return UserFactory() + + +@pytest.fixture +def request_factory() -> RequestFactory: + return RequestFactory() diff --git a/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/users/adapters.py b/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/users/adapters.py index 5b63593b..9361d6ec 100644 --- a/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/users/adapters.py +++ b/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/users/adapters.py @@ -1,15 +1,18 @@ -from django.conf import settings +from typing import Any + from allauth.account.adapter import DefaultAccountAdapter from allauth.socialaccount.adapter import DefaultSocialAccountAdapter +from django.conf import settings +from django.http import HttpRequest class AccountAdapter(DefaultAccountAdapter): - def is_open_for_signup(self, request): + def is_open_for_signup(self, request: HttpRequest): return getattr(settings, "ACCOUNT_ALLOW_REGISTRATION", True) class SocialAccountAdapter(DefaultSocialAccountAdapter): - def is_open_for_signup(self, request, sociallogin): + def is_open_for_signup(self, request: HttpRequest, sociallogin: Any): return getattr(settings, "ACCOUNT_ALLOW_REGISTRATION", True) diff --git a/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/users/admin.py b/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/users/admin.py index 6b5a60c7..cc6efed5 100644 --- a/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/users/admin.py +++ b/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/users/admin.py @@ -1,40 +1,17 @@ -from django import forms from django.contrib import admin -from django.contrib.auth.admin import UserAdmin as AuthUserAdmin -from django.contrib.auth.forms import UserChangeForm, UserCreationForm -from .models import User -from django.utils.translation import ugettext_lazy as _ +from django.contrib.auth import admin as auth_admin +from django.contrib.auth import get_user_model +from {{ cookiecutter.project_slug }}.users.forms import UserChangeForm, UserCreationForm -class MyUserChangeForm(UserChangeForm): - - class Meta(UserChangeForm.Meta): - model = User - - -class MyUserCreationForm(UserCreationForm): - - error_message = UserCreationForm.error_messages.update( - {"duplicate_username": _("This username has already been taken.")} - ) - - class Meta(UserCreationForm.Meta): - model = User - - def clean_username(self): - username = self.cleaned_data["username"] - try: - User.objects.get(username=username) - except User.DoesNotExist: - return username - - raise forms.ValidationError(self.error_messages["duplicate_username"]) +User = get_user_model() @admin.register(User) -class MyUserAdmin(AuthUserAdmin): - form = MyUserChangeForm - add_form = MyUserCreationForm - fieldsets = (("User Profile", {"fields": ("name",)}),) + AuthUserAdmin.fieldsets - list_display = ("username", "name", "is_superuser") +class UserAdmin(auth_admin.UserAdmin): + + form = UserChangeForm + add_form = UserCreationForm + fieldsets = (("User", {"fields": ("name",)}),) + auth_admin.UserAdmin.fieldsets + list_display = ["username", "name", "is_superuser"] search_fields = ["name"] diff --git a/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/users/apps.py b/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/users/apps.py index 32fab76d..854665fd 100644 --- a/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/users/apps.py +++ b/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/users/apps.py @@ -2,14 +2,11 @@ from django.apps import AppConfig class UsersAppConfig(AppConfig): - name = "{{cookiecutter.project_slug}}.users" + + name = "{{ cookiecutter.project_slug }}.users" verbose_name = "Users" def ready(self): - """Override this to put in: - Users system checks - Users signal registration - """ try: import users.signals # noqa F401 except ImportError: diff --git a/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/users/forms.py b/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/users/forms.py new file mode 100644 index 00000000..7bba81ff --- /dev/null +++ b/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/users/forms.py @@ -0,0 +1,31 @@ +from django.contrib.auth import get_user_model, forms +from django.core.exceptions import ValidationError +from django.utils.translation import ugettext_lazy as _ + +User = get_user_model() + + +class UserChangeForm(forms.UserChangeForm): + + class Meta(forms.UserChangeForm.Meta): + model = User + + +class UserCreationForm(forms.UserCreationForm): + + error_message = forms.UserCreationForm.error_messages.update( + {"duplicate_username": _("This username has already been taken.")} + ) + + class Meta(forms.UserCreationForm.Meta): + model = User + + def clean_username(self): + username = self.cleaned_data["username"] + + try: + User.objects.get(username=username) + except User.DoesNotExist: + return username + + raise ValidationError(self.error_messages["duplicate_username"]) diff --git a/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/users/models.py b/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/users/models.py index 30475871..8f07b15a 100644 --- a/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/users/models.py +++ b/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/users/models.py @@ -1,5 +1,5 @@ from django.contrib.auth.models import AbstractUser -from django.db import models +from django.db.models import CharField from django.urls import reverse from django.utils.translation import ugettext_lazy as _ @@ -8,10 +8,7 @@ class User(AbstractUser): # First Name and Last Name do not cover name patterns # around the globe. - name = models.CharField(_("Name of User"), blank=True, max_length=255) - - def __str__(self): - return self.username + name = CharField(_("Name of User"), blank=True, max_length=255) def get_absolute_url(self): return reverse("users:detail", kwargs={"username": self.username}) diff --git a/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/users/tests/factories.py b/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/users/tests/factories.py index 8a871b64..00990576 100644 --- a/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/users/tests/factories.py +++ b/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/users/tests/factories.py @@ -1,11 +1,29 @@ -import factory +from typing import Any, Sequence + +from django.contrib.auth import get_user_model +from factory import DjangoModelFactory, Faker, post_generation -class UserFactory(factory.django.DjangoModelFactory): - username = factory.Sequence(lambda n: f"user-{n}") - email = factory.Sequence(lambda n: f"user-{n}@example.com") - password = factory.PostGenerationMethodCall("set_password", "password") +class UserFactory(DjangoModelFactory): + + username = Faker("user_name") + email = Faker("email") + name = Faker("name") + + @post_generation + def password(self, create: bool, extracted: Sequence[Any], **kwargs): + password = Faker( + "password", + length=42, + special_chars=True, + digits=True, + upper_case=True, + lower_case=True, + ).generate( + extra_kwargs={} + ) + self.set_password(password) class Meta: - model = "users.User" - django_get_or_create = ("username",) + model = get_user_model() + django_get_or_create = ["username"] diff --git a/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/users/tests/test_admin.py b/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/users/tests/test_admin.py deleted file mode 100644 index a3307103..00000000 --- a/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/users/tests/test_admin.py +++ /dev/null @@ -1,44 +0,0 @@ -from test_plus.test import TestCase - -from ..admin import MyUserCreationForm - - -class TestMyUserCreationForm(TestCase): - - def setUp(self): - self.user = self.make_user("notalamode", "notalamodespassword") - - def test_clean_username_success(self): - # Instantiate the form with a new username - form = MyUserCreationForm( - { - "username": "alamode", - "password1": "7jefB#f@Cc7YJB]2v", - "password2": "7jefB#f@Cc7YJB]2v", - } - ) - # Run is_valid() to trigger the validation - valid = form.is_valid() - self.assertTrue(valid) - - # Run the actual clean_username method - username = form.clean_username() - self.assertEqual("alamode", username) - - def test_clean_username_false(self): - # Instantiate the form with the same username as self.user - form = MyUserCreationForm( - { - "username": self.user.username, - "password1": "notalamodespassword", - "password2": "notalamodespassword", - } - ) - # Run is_valid() to trigger the validation, which is going to fail - # because the username is already taken - valid = form.is_valid() - self.assertFalse(valid) - - # The form.errors dict should contain a single error called 'username' - self.assertTrue(len(form.errors) == 1) - self.assertTrue("username" in form.errors) diff --git a/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/users/tests/test_forms.py b/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/users/tests/test_forms.py new file mode 100644 index 00000000..e8066164 --- /dev/null +++ b/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/users/tests/test_forms.py @@ -0,0 +1,41 @@ +import pytest + +from {{ cookiecutter.project_slug }}.users.forms import UserCreationForm +from {{ cookiecutter.project_slug }}.users.tests.factories import UserFactory + +pytestmark = pytest.mark.django_db + + +class TestUserCreationForm: + + def test_clean_username(self): + # A user with proto_user params does not exist yet. + proto_user = UserFactory.build() + + form = UserCreationForm( + { + "username": proto_user.username, + "password1": proto_user._password, + "password2": proto_user._password, + } + ) + + assert form.is_valid() + assert form.clean_username() == proto_user.username + + # Creating a user. + form.save() + + # The user with proto_user params already exists, + # hence cannot be created. + form = UserCreationForm( + { + "username": proto_user.username, + "password1": proto_user._password, + "password2": proto_user._password, + } + ) + + assert not form.is_valid() + assert len(form.errors) == 1 + assert "username" in form.errors diff --git a/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/users/tests/test_models.py b/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/users/tests/test_models.py index 13121a01..54863632 100644 --- a/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/users/tests/test_models.py +++ b/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/users/tests/test_models.py @@ -1,16 +1,8 @@ -from test_plus.test import TestCase +import pytest +from django.conf import settings + +pytestmark = pytest.mark.django_db -class TestUser(TestCase): - - def setUp(self): - self.user = self.make_user() - - def test__str__(self): - self.assertEqual( - self.user.__str__(), - "testuser", # This is the default username for self.make_user() - ) - - def test_get_absolute_url(self): - self.assertEqual(self.user.get_absolute_url(), "/users/testuser/") +def test_user_get_absolute_url(user: settings.AUTH_USER_MODEL): + assert user.get_absolute_url() == f"/users/{user.username}/" 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 6b072436..20bd3dba 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,44 +1,28 @@ +import pytest +from django.conf import settings from django.urls import reverse, resolve -from test_plus.test import TestCase +pytestmark = pytest.mark.django_db -class TestUserURLs(TestCase): - """Test URL patterns for users app.""" +def test_detail(user: settings.AUTH_USER_MODEL): + assert ( + reverse("users:detail", kwargs={"username": user.username}) + == f"/users/{user.username}/" + ) + assert resolve(f"/users/{user.username}/").view_name == "users:detail" - def setUp(self): - self.user = self.make_user() - def test_list_reverse(self): - """users:list should reverse to /users/.""" - self.assertEqual(reverse("users:list"), "/users/") +def test_list(): + assert reverse("users:list") == "/users/" + assert resolve("/users/").view_name == "users:list" - def test_list_resolve(self): - """/users/ should resolve to users:list.""" - self.assertEqual(resolve("/users/").view_name, "users:list") - def test_redirect_reverse(self): - """users:redirect should reverse to /users/~redirect/.""" - self.assertEqual(reverse("users:redirect"), "/users/~redirect/") +def test_update(): + assert reverse("users:update") == "/users/~update/" + assert resolve("/users/~update/").view_name == "users:update" - def test_redirect_resolve(self): - """/users/~redirect/ should resolve to users:redirect.""" - self.assertEqual(resolve("/users/~redirect/").view_name, "users:redirect") - def test_detail_reverse(self): - """users:detail should reverse to /users/testuser/.""" - self.assertEqual( - reverse("users:detail", kwargs={"username": "testuser"}), "/users/testuser/" - ) - - def test_detail_resolve(self): - """/users/testuser/ should resolve to users:detail.""" - self.assertEqual(resolve("/users/testuser/").view_name, "users:detail") - - def test_update_reverse(self): - """users:update should reverse to /users/~update/.""" - self.assertEqual(reverse("users:update"), "/users/~update/") - - def test_update_resolve(self): - """/users/~update/ should resolve to users:update.""" - self.assertEqual(resolve("/users/~update/").view_name, "users:update") +def test_redirect(): + assert reverse("users:redirect") == "/users/~redirect/" + assert resolve("/users/~redirect/").view_name == "users:redirect" diff --git a/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/users/tests/test_views.py b/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/users/tests/test_views.py index 07cbda66..0992e462 100644 --- a/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/users/tests/test_views.py +++ b/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/users/tests/test_views.py @@ -1,52 +1,53 @@ +import pytest +from django.conf import settings from django.test import RequestFactory -from test_plus.test import TestCase +from {{ cookiecutter.project_slug }}.users.views import UserRedirectView, UserUpdateView -from ..views import UserRedirectView, UserUpdateView +pytestmark = pytest.mark.django_db -class BaseUserTestCase(TestCase): +class TestUserUpdateView: + """ + TODO: + extracting view initialization code as class-scoped fixture + would be great if only pytest-django supported non-function-scoped + fixture db access -- this is a work-in-progress for now: + https://github.com/pytest-dev/pytest-django/pull/258 + """ - def setUp(self): - self.user = self.make_user() - self.factory = RequestFactory() + def test_get_success_url( + self, user: settings.AUTH_USER_MODEL, request_factory: RequestFactory + ): + view = UserUpdateView() + request = request_factory.get("/fake-url/") + request.user = user - -class TestUserRedirectView(BaseUserTestCase): - - def test_get_redirect_url(self): - # Instantiate the view directly. Never do this outside a test! - view = UserRedirectView() - # Generate a fake request - request = self.factory.get("/fake-url") - # Attach the user to the request - request.user = self.user - # Attach the request to the view view.request = request - # Expect: '/users/testuser/', as that is the default username for - # self.make_user() - self.assertEqual(view.get_redirect_url(), "/users/testuser/") + + assert view.get_success_url() == f"/users/{user.username}/" + + def test_get_object( + self, user: settings.AUTH_USER_MODEL, request_factory: RequestFactory + ): + view = UserUpdateView() + request = request_factory.get("/fake-url/") + request.user = user + + view.request = request + + assert view.get_object() == user -class TestUserUpdateView(BaseUserTestCase): +class TestUserRedirectView: - def setUp(self): - # call BaseUserTestCase.setUp() - super(TestUserUpdateView, self).setUp() - # Instantiate the view directly. Never do this outside a test! - self.view = UserUpdateView() - # Generate a fake request - request = self.factory.get("/fake-url") - # Attach the user to the request - request.user = self.user - # Attach the request to the view - self.view.request = request + def test_get_redirect_url( + self, user: settings.AUTH_USER_MODEL, request_factory: RequestFactory + ): + view = UserRedirectView() + request = request_factory.get("/fake-url") + request.user = user - def test_get_success_url(self): - # Expect: '/users/testuser/', as that is the default username for - # self.make_user() - self.assertEqual(self.view.get_success_url(), "/users/testuser/") + view.request = request - def test_get_object(self): - # Expect: self.user, as that is the request's user object - self.assertEqual(self.view.get_object(), self.user) + assert view.get_redirect_url() == f"/users/{user.username}/" diff --git a/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/users/urls.py b/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/users/urls.py index fef93ad5..2502a0c0 100644 --- a/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/users/urls.py +++ b/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/users/urls.py @@ -1,15 +1,16 @@ from django.urls import path -from . import views +from {{ cookiecutter.project_slug }}.users.views import ( + user_list_view, + user_redirect_view, + user_update_view, + user_detail_view, +) app_name = "users" urlpatterns = [ - path("", view=views.UserListView.as_view(), name="list"), - path("~redirect/", view=views.UserRedirectView.as_view(), name="redirect"), - path("~update/", view=views.UserUpdateView.as_view(), name="update"), - path( - "/", - view=views.UserDetailView.as_view(), - name="detail", - ), + path("", view=user_list_view, name="list"), + path("~redirect/", view=user_redirect_view, name="redirect"), + path("~update/", view=user_update_view, name="update"), + path("/", view=user_detail_view, name="detail"), ] diff --git a/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/users/views.py b/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/users/views.py index a9038b71..35e26e94 100644 --- a/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/users/views.py +++ b/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/users/views.py @@ -1,43 +1,52 @@ +from django.contrib.auth import get_user_model 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 +User = get_user_model() class UserDetailView(LoginRequiredMixin, DetailView): + model = User - # These next two lines tell the view to index lookups by username slug_field = "username" slug_url_kwarg = "username" +user_detail_view = UserDetailView.as_view() + + +class UserListView(LoginRequiredMixin, ListView): + + model = User + slug_field = "username" + slug_url_kwarg = "username" + + +user_list_view = UserListView.as_view() + + +class UserUpdateView(LoginRequiredMixin, UpdateView): + + model = User + fields = ["name"] + + def get_success_url(self): + return reverse("users:detail", kwargs={"username": self.request.user.username}) + + def get_object(self): + return User.objects.get(username=self.request.user.username) + + +user_update_view = UserUpdateView.as_view() + + class UserRedirectView(LoginRequiredMixin, RedirectView): + permanent = False def get_redirect_url(self): return reverse("users:detail", kwargs={"username": self.request.user.username}) -class UserUpdateView(LoginRequiredMixin, UpdateView): - - fields = ["name"] - - # we already imported User in the view code above, remember? - model = User - - # send the user back to their own page after a successful update - - def get_success_url(self): - return reverse("users:detail", kwargs={"username": self.request.user.username}) - - def get_object(self): - # Only get the User record for the user making the request - return User.objects.get(username=self.request.user.username) - - -class UserListView(LoginRequiredMixin, ListView): - model = User - # These next two lines tell the view to index lookups by username - slug_field = "username" - slug_url_kwarg = "username" +user_redirect_view = UserRedirectView.as_view() From 0a9c0cb06acc4325f0fd2b5f33dff57db9747f2a Mon Sep 17 00:00:00 2001 From: "Nikita P. Shupeyko" Date: Wed, 27 Jun 2018 19:45:36 +0300 Subject: [PATCH 12/56] Upgrade Docker Compose project template configs to version 3 --- {{cookiecutter.project_slug}}/local.yml | 2 +- {{cookiecutter.project_slug}}/production.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/{{cookiecutter.project_slug}}/local.yml b/{{cookiecutter.project_slug}}/local.yml index ac13d185..41808e60 100644 --- a/{{cookiecutter.project_slug}}/local.yml +++ b/{{cookiecutter.project_slug}}/local.yml @@ -1,4 +1,4 @@ -version: '2' +version: '3' volumes: postgres_data_local: {} diff --git a/{{cookiecutter.project_slug}}/production.yml b/{{cookiecutter.project_slug}}/production.yml index 9415db61..edcc7e7b 100644 --- a/{{cookiecutter.project_slug}}/production.yml +++ b/{{cookiecutter.project_slug}}/production.yml @@ -1,4 +1,4 @@ -version: '2' +version: '3' volumes: postgres_data: {} From 3ac990267000baa673dafc79cca442459b33b840 Mon Sep 17 00:00:00 2001 From: "Nikita P. Shupeyko" Date: Wed, 27 Jun 2018 19:52:06 +0300 Subject: [PATCH 13/56] Rename project template Docker Compose volumes Rationale: consistent image, volume etc. naming conventions --- docs/deployment-with-docker.rst | 2 +- docs/developing-locally-docker.rst | 4 ++-- {{cookiecutter.project_slug}}/local.yml | 8 ++++---- {{cookiecutter.project_slug}}/production.yml | 12 ++++++------ 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/docs/deployment-with-docker.rst b/docs/deployment-with-docker.rst index 0115e3a4..b2166824 100644 --- a/docs/deployment-with-docker.rst +++ b/docs/deployment-with-docker.rst @@ -73,7 +73,7 @@ You can read more about this here at `Automatic HTTPS`_ in the Caddy docs. (Optional) Postgres Data Volume Modifications --------------------------------------------- -Postgres is saving its database files to the ``postgres_data`` volume by default. Change that if you want something else and make sure to make backups since this is not done automatically. +Postgres is saving its database files to the ``production_postgres_data`` volume by default. Change that if you want something else and make sure to make backups since this is not done automatically. Building & Running Production Stack diff --git a/docs/developing-locally-docker.rst b/docs/developing-locally-docker.rst index c6af1d96..08b25f3b 100644 --- a/docs/developing-locally-docker.rst +++ b/docs/developing-locally-docker.rst @@ -91,8 +91,8 @@ This is the excerpt from your project's ``local.yml``: :: context: . dockerfile: ./compose/production/postgres/Dockerfile volumes: - - postgres_data_local:/var/lib/postgresql/data - - postgres_backup_local:/backups + - local_postgres_data:/var/lib/postgresql/data + - local_postgres_data_backups:/backups env_file: - ./.envs/.local/.postgres diff --git a/{{cookiecutter.project_slug}}/local.yml b/{{cookiecutter.project_slug}}/local.yml index 41808e60..36638932 100644 --- a/{{cookiecutter.project_slug}}/local.yml +++ b/{{cookiecutter.project_slug}}/local.yml @@ -1,8 +1,8 @@ version: '3' volumes: - postgres_data_local: {} - postgres_backup_local: {} + local_postgres_data: {} + local_postgres_data_backups: {} services: django:{% if cookiecutter.use_celery == 'y' %} &django{% endif %} @@ -30,8 +30,8 @@ services: dockerfile: ./compose/production/postgres/Dockerfile image: {{ cookiecutter.project_slug }}_production_postgres volumes: - - postgres_data_local:/var/lib/postgresql/data - - postgres_backup_local:/backups + - local_postgres_data:/var/lib/postgresql/data + - local_postgres_data_backups:/backups env_file: - ./.envs/.local/.postgres {%- if cookiecutter.use_mailhog == 'y' %} diff --git a/{{cookiecutter.project_slug}}/production.yml b/{{cookiecutter.project_slug}}/production.yml index edcc7e7b..fd8388ac 100644 --- a/{{cookiecutter.project_slug}}/production.yml +++ b/{{cookiecutter.project_slug}}/production.yml @@ -1,9 +1,9 @@ version: '3' volumes: - postgres_data: {} - postgres_backup: {} - caddy: {} + production_postgres_data: {} + production_postgres_data_backups: {} + production_caddy: {} services: django:{% if cookiecutter.use_celery == 'y' %} &django{% endif %} @@ -25,8 +25,8 @@ services: dockerfile: ./compose/production/postgres/Dockerfile image: {{ cookiecutter.project_slug }}_production_postgres volumes: - - postgres_data:/var/lib/postgresql/data - - postgres_backup:/backups + - production_postgres_data:/var/lib/postgresql/data + - production_postgres_data_backups:/backups env_file: - ./.envs/.production/.postgres @@ -38,7 +38,7 @@ services: depends_on: - django volumes: - - caddy:/root/.caddy + - production_caddy:/root/.caddy env_file: - ./.envs/.production/.caddy ports: From 49c73feebb20bc29db51512028713bd6754c954e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A1bio=20C=2E=20Barrionuevo=20da=20Luz?= Date: Thu, 28 Jun 2018 09:00:53 -0300 Subject: [PATCH 14/56] remove inline comments of on heroku tutorial --- docs/deployment-on-heroku.rst | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/docs/deployment-on-heroku.rst b/docs/deployment-on-heroku.rst index 7006a287..d7d95184 100644 --- a/docs/deployment-on-heroku.rst +++ b/docs/deployment-on-heroku.rst @@ -21,17 +21,27 @@ Run these commands to deploy the project to Heroku: heroku addons:create sentry:f1 heroku config:set PYTHONHASHSEED=random + heroku config:set WEB_CONCURRENCY=4 + heroku config:set DJANGO_DEBUG=False heroku config:set DJANGO_SETTINGS_MODULE=config.settings.production heroku config:set DJANGO_SECRET_KEY="$(openssl rand -base64 64)" + # Generating a 32 character-long random string without any of the visually similiar characters "IOl01": heroku config:set DJANGO_ADMIN_URL="$(openssl rand -base64 4096 | tr -dc 'A-HJ-NP-Za-km-z2-9' | head -c 32)/" - heroku config:set DJANGO_ALLOWED_HOSTS= # Set this to your Heroku app url, e.g. 'bionic-beaver-28392.herokuapp.com' - - heroku config:set DJANGO_AWS_ACCESS_KEY_ID= # Assign with AWS_ACCESS_KEY_ID - heroku config:set DJANGO_AWS_SECRET_ACCESS_KEY= # Assign with AWS_SECRET_ACCESS_KEY - heroku config:set DJANGO_AWS_STORAGE_BUCKET_NAME= # Assign with AWS_STORAGE_BUCKET_NAME + + # Set this to your Heroku app url, e.g. 'bionic-beaver-28392.herokuapp.com' + heroku config:set DJANGO_ALLOWED_HOSTS= + + # Assign with AWS_ACCESS_KEY_ID + heroku config:set DJANGO_AWS_ACCESS_KEY_ID= + + # Assign with AWS_SECRET_ACCESS_KEY + heroku config:set DJANGO_AWS_SECRET_ACCESS_KEY= + + # Assign with AWS_STORAGE_BUCKET_NAME + heroku config:set DJANGO_AWS_STORAGE_BUCKET_NAME= git push heroku master From ac61117b59e8aaf8a644501f432cb71e8e5df9a2 Mon Sep 17 00:00:00 2001 From: "Nikita P. Shupeyko" Date: Thu, 28 Jun 2018 16:35:35 +0300 Subject: [PATCH 15/56] Prevent AWS S3 bucket from being created automatically Rationale: most of the time you want to create a bucket yourself in order to assign/tweak polices etc. --- {{cookiecutter.project_slug}}/config/settings/production.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/{{cookiecutter.project_slug}}/config/settings/production.py b/{{cookiecutter.project_slug}}/config/settings/production.py index ecd517dd..39df0cbf 100644 --- a/{{cookiecutter.project_slug}}/config/settings/production.py +++ b/{{cookiecutter.project_slug}}/config/settings/production.py @@ -73,8 +73,6 @@ AWS_SECRET_ACCESS_KEY = env('DJANGO_AWS_SECRET_ACCESS_KEY') # https://django-storages.readthedocs.io/en/latest/backends/amazon-S3.html#settings AWS_STORAGE_BUCKET_NAME = env('DJANGO_AWS_STORAGE_BUCKET_NAME') # https://django-storages.readthedocs.io/en/latest/backends/amazon-S3.html#settings -AWS_AUTO_CREATE_BUCKET = True -# https://django-storages.readthedocs.io/en/latest/backends/amazon-S3.html#settings AWS_QUERYSTRING_AUTH = False # DO NOT change these unless you know what you're doing. _AWS_EXPIRY = 60 * 60 * 24 * 7 From c5c6bace995473ab3d7a6c9c7927614660a430cd Mon Sep 17 00:00:00 2001 From: "Nikita P. Shupeyko" Date: Thu, 28 Jun 2018 16:39:51 +0300 Subject: [PATCH 16/56] Remove LICENSE for non open source projects --- hooks/post_gen_project.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/hooks/post_gen_project.py b/hooks/post_gen_project.py index 9118f6c9..b75ec3d9 100644 --- a/hooks/post_gen_project.py +++ b/hooks/post_gen_project.py @@ -32,7 +32,10 @@ DEBUG_VALUE = "debug" def remove_open_source_files(): - file_names = ["CONTRIBUTORS.txt"] + file_names = [ + "CONTRIBUTORS.txt", + "LICENSE", + ] for file_name in file_names: os.remove(file_name) From ed7609f7153f297b674019df3a58f053f68f25c2 Mon Sep 17 00:00:00 2001 From: "Nikita P. Shupeyko" Date: Thu, 28 Jun 2018 16:43:34 +0300 Subject: [PATCH 17/56] Remove utility/ when use_docker=y --- hooks/post_gen_project.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/hooks/post_gen_project.py b/hooks/post_gen_project.py index b75ec3d9..669edb0e 100644 --- a/hooks/post_gen_project.py +++ b/hooks/post_gen_project.py @@ -64,6 +64,10 @@ def remove_docker_files(): os.remove(file_name) +def remove_utility_files(): + shutil.rmtree("utility") + + def remove_heroku_files(): file_names = ["Procfile", "runtime.txt", "requirements.txt"] for file_name in file_names: @@ -278,7 +282,9 @@ def main(): if "{{ cookiecutter.use_pycharm }}".lower() == "n": remove_pycharm_files() - if "{{ cookiecutter.use_docker }}".lower() == "n": + if "{{ cookiecutter.use_docker }}".lower() == "y": + remove_utility_files() + else: remove_docker_files() if "{{ cookiecutter.use_heroku }}".lower() == "n": From f13c99f0a50892dbd35206176390e1821ae270bc Mon Sep 17 00:00:00 2001 From: "pyup.io bot" Date: Sat, 30 Jun 2018 10:59:23 +0200 Subject: [PATCH 18/56] Update pytz from 2018.4 to 2018.5 (#1699) --- {{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 5dd5d99e..74a417e2 100644 --- a/{{cookiecutter.project_slug}}/requirements/base.txt +++ b/{{cookiecutter.project_slug}}/requirements/base.txt @@ -1,4 +1,4 @@ -pytz==2018.4 # https://github.com/stub42/pytz +pytz==2018.5 # https://github.com/stub42/pytz python-slugify==1.2.5 # https://github.com/un33k/python-slugify Pillow==5.1.0 # https://github.com/python-pillow/Pillow {%- if cookiecutter.use_compressor == "y" %} From d7a05cf69d30e7bdb2b735ad30cb26f1dc5ec1a9 Mon Sep 17 00:00:00 2001 From: Denis Orehovsky Date: Mon, 2 Jul 2018 10:22:48 +0300 Subject: [PATCH 19/56] Add mypy to the local dependencies --- {{cookiecutter.project_slug}}/README.rst | 9 +++++++++ .../requirements/local.txt | 1 + {{cookiecutter.project_slug}}/setup.cfg | 14 ++++++++++++++ 3 files changed, 24 insertions(+) diff --git a/{{cookiecutter.project_slug}}/README.rst b/{{cookiecutter.project_slug}}/README.rst index 3386d985..2f40710e 100644 --- a/{{cookiecutter.project_slug}}/README.rst +++ b/{{cookiecutter.project_slug}}/README.rst @@ -32,6 +32,15 @@ Setting Up Your Users For convenience, you can keep your normal user logged in on Chrome and your superuser logged in on Firefox (or similar), so that you can see how the site behaves for both kinds of users. +Type checks +^^^^^^^^^^^ + +Running type checks with mypy: + +:: + + $ mypy {{cookiecutter.project_slug}} + Test coverage ^^^^^^^^^^^^^ diff --git a/{{cookiecutter.project_slug}}/requirements/local.txt b/{{cookiecutter.project_slug}}/requirements/local.txt index 63799d99..b8a7609c 100644 --- a/{{cookiecutter.project_slug}}/requirements/local.txt +++ b/{{cookiecutter.project_slug}}/requirements/local.txt @@ -11,6 +11,7 @@ psycopg2-binary==2.7.5 # https://github.com/psycopg/psycopg2 # Testing # ------------------------------------------------------------------------------ +mypy==0.610 # https://github.com/python/mypy pytest==3.6.2 # https://github.com/pytest-dev/pytest pytest-sugar==0.9.1 # https://github.com/Frozenball/pytest-sugar diff --git a/{{cookiecutter.project_slug}}/setup.cfg b/{{cookiecutter.project_slug}}/setup.cfg index 1ec89c78..c2139f1d 100644 --- a/{{cookiecutter.project_slug}}/setup.cfg +++ b/{{cookiecutter.project_slug}}/setup.cfg @@ -5,3 +5,17 @@ exclude = .tox,.git,*/migrations/*,*/static/CACHE/*,docs,node_modules [pycodestyle] max-line-length = 120 exclude = .tox,.git,*/migrations/*,*/static/CACHE/*,docs,node_modules + +[mypy] +python_version = 3.6 +check_untyped_defs = True +ignore_errors = False +ignore_missing_imports = True +strict_optional = True +warn_unused_ignores = True +warn_redundant_casts = True +warn_unused_configs = True + +[mypy-*.migrations.*] +# Django migrations should not produce any errors: +ignore_errors = True From 8586cb0cefe7b6b3467e57b17021ac66599edc90 Mon Sep 17 00:00:00 2001 From: "pyup.io bot" Date: Mon, 2 Jul 2018 21:17:46 +0200 Subject: [PATCH 20/56] Update pillow from 5.1.0 to 5.2.0 (#1704) --- {{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 74a417e2..26296fe1 100644 --- a/{{cookiecutter.project_slug}}/requirements/base.txt +++ b/{{cookiecutter.project_slug}}/requirements/base.txt @@ -1,6 +1,6 @@ pytz==2018.5 # https://github.com/stub42/pytz python-slugify==1.2.5 # https://github.com/un33k/python-slugify -Pillow==5.1.0 # https://github.com/python-pillow/Pillow +Pillow==5.2.0 # https://github.com/python-pillow/Pillow {%- if cookiecutter.use_compressor == "y" %} rcssmin==1.0.6{% if cookiecutter.windows == 'y' %} --install-option="--without-c-extensions"{% endif %} # https://github.com/ndparker/rcssmin {%- endif %} From ed389e7401b92b988d04d4bb8bf0fd66007eb7bc Mon Sep 17 00:00:00 2001 From: "pyup.io bot" Date: Mon, 2 Jul 2018 21:18:13 +0200 Subject: [PATCH 21/56] Update django from 2.0.6 to 2.0.7 (#1707) --- {{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 26296fe1..9d49be2a 100644 --- a/{{cookiecutter.project_slug}}/requirements/base.txt +++ b/{{cookiecutter.project_slug}}/requirements/base.txt @@ -18,7 +18,7 @@ flower==0.9.2 # https://github.com/mher/flower # Django # ------------------------------------------------------------------------------ -django==2.0.6 # pyup: < 2.1 # https://www.djangoproject.com/ +django==2.0.7 # pyup: < 2.1 # https://www.djangoproject.com/ django-environ==0.4.5 # https://github.com/joke2k/django-environ django-model-utils==3.1.2 # https://github.com/jazzband/django-model-utils django-allauth==0.36.0 # https://github.com/pennersr/django-allauth From f92acfacc4742867a1ed8584963db188dd97e965 Mon Sep 17 00:00:00 2001 From: "pyup.io bot" Date: Thu, 5 Jul 2018 16:41:25 +0200 Subject: [PATCH 22/56] Update pytest to 3.6.3 (#1709) * Update pytest from 3.6.2 to 3.6.3 * Update pytest from 3.6.2 to 3.6.3 --- requirements.txt | 2 +- {{cookiecutter.project_slug}}/requirements/local.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/requirements.txt b/requirements.txt index 77770fa9..68a36940 100644 --- a/requirements.txt +++ b/requirements.txt @@ -9,5 +9,5 @@ flake8==3.5.0 # Testing # ------------------------------------------------------------------------------ tox==3.0.0 -pytest==3.6.2 +pytest==3.6.3 pytest-cookies==0.3.0 diff --git a/{{cookiecutter.project_slug}}/requirements/local.txt b/{{cookiecutter.project_slug}}/requirements/local.txt index 63799d99..c88fe885 100644 --- a/{{cookiecutter.project_slug}}/requirements/local.txt +++ b/{{cookiecutter.project_slug}}/requirements/local.txt @@ -11,7 +11,7 @@ psycopg2-binary==2.7.5 # https://github.com/psycopg/psycopg2 # Testing # ------------------------------------------------------------------------------ -pytest==3.6.2 # https://github.com/pytest-dev/pytest +pytest==3.6.3 # https://github.com/pytest-dev/pytest pytest-sugar==0.9.1 # https://github.com/Frozenball/pytest-sugar # Code quality From 494492b1dbba8b96c03b700064c5956f225695fb Mon Sep 17 00:00:00 2001 From: "pyup.io bot" Date: Tue, 10 Jul 2018 04:27:59 +0200 Subject: [PATCH 23/56] Update tox to 3.1.1 (#1715) This PR updates [tox](https://pypi.org/project/tox) from **3.0.0** to **3.1.1**.
Changelog ### 3.1.0 ``` ------------------ Bugfixes ^^^^^^^^ - Add ``ignore_basepython_conflict``, which determines whether conflicting ``basepython`` settings for environments containing default factors, such as ``py27`` or ``django18-py35``, should be ignored or result in warnings. This was a common source of misconfiguration and is rarely, if ever, desirable from a user perspective - by :user:`stephenfin` (`477 <https://github.com/tox-dev/tox/issues/477>`_) - Fix bug with incorrectly defactorized dependencies (deps passed to pip were not de-factorized) - by :user:`bartsanchez` (`706 <https://github.com/tox-dev/tox/issues/706>`_) Features ^^^^^^^^ - Add support for multiple PyPy versions using default factors. This allows you to use, for example, ``pypy27`` knowing that the correct intepreter will be used by default - by :user:`stephenfin` (`19 <https://github.com/tox-dev/tox/issues/19>`_) - Add support to explicitly invoke interpreter directives for environments with long path lengths. In the event that ``tox`` cannot invoke scripts with a system-limited shebang (e.x. a Linux host running a Jenkins Pipeline), a user can set the environment variable ``TOX_LIMITED_SHEBANG`` to workaround the system's limitation (e.x. ``export TOX_LIMITED_SHEBANG=1``) - by :user:`jdknight` (`794 <https://github.com/tox-dev/tox/issues/794>`_) - introduce a constants module to be used internally and as experimental API - by :user:`obestwalter` (`798 <https://github.com/tox-dev/tox/issues/798>`_) - Make ``py2`` and ``py3`` aliases also resolve via ``py`` on windows by :user:`asottile`. This enables the following things: ``tox -e py2`` and ``tox -e py3`` work on windows (they already work on posix); and setting ``basepython=python2`` or ``basepython=python3`` now works on windows. (`856 <https://github.com/tox-dev/tox/issues/856>`_) - Replace the internal version parsing logic from the not well tested `PEP-386 <https://www.python.org/dev/peps/pep-0386/>`_ parser for the more general `PEP-440 <https://www.python.org/dev/peps/pep-0440/>`_. `packaging >= 17.1 <https://pypi.org/project/packaging/>`_ is now an install dependency by :user:`gaborbernat`. (`860 <https://github.com/tox-dev/tox/issues/860>`_) Documentation ^^^^^^^^^^^^^ - extend the plugin documentation and make lot of small fixes and improvements - by :user:`obestwalter` (`797 <https://github.com/tox-dev/tox/issues/797>`_) - tidy up tests - remove unused fixtures, update old cinstructs, etc. - by :user:`obestwalter` (`799 <https://github.com/tox-dev/tox/issues/799>`_) - Various improvements to documentation: open browser once documentation generation is done, show Github/Travis info on documentation page, remove duplicate header for changelog, generate unreleased news as DRAFT on top of changelog, make the changelog page more compact and readable (width up to 1280px) by :user:`gaborbernat` (`859 <https://github.com/tox-dev/tox/issues/859>`_) Miscellaneous ^^^^^^^^^^^^^ - filter out unwanted files in package - by :user:`obestwalter` (`754 <https://github.com/tox-dev/tox/issues/754>`_) - make the already existing implicit API explicit - by :user:`obestwalter` (`800 <https://github.com/tox-dev/tox/issues/800>`_) - improve tox quickstart and corresponding tests - by :user:`obestwalter` (`801 <https://github.com/tox-dev/tox/issues/801>`_) - tweak codecov settings via .codecov.yml - by :user:`obestwalter` (`802 <https://github.com/tox-dev/tox/issues/802>`_) ```
Links - PyPI: https://pypi.org/project/tox - Changelog: https://pyup.io/changelogs/tox/ - Docs: https://tox.readthedocs.org/
--- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 68a36940..fca457e7 100644 --- a/requirements.txt +++ b/requirements.txt @@ -8,6 +8,6 @@ flake8==3.5.0 # Testing # ------------------------------------------------------------------------------ -tox==3.0.0 +tox==3.1.1 pytest==3.6.3 pytest-cookies==0.3.0 From 27bc27e634c8b6b23f351cad5f52d4b860df0314 Mon Sep 17 00:00:00 2001 From: Hendrik Schneider Date: Tue, 10 Jul 2018 22:22:10 +0000 Subject: [PATCH 24/56] Update project.js --- .../{{cookiecutter.project_slug}}/static/js/project.js | 1 - 1 file changed, 1 deletion(-) diff --git a/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/static/js/project.js b/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/static/js/project.js index 91ab9e2d..32280655 100644 --- a/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/static/js/project.js +++ b/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/static/js/project.js @@ -18,4 +18,3 @@ Issues with the above approach: 3. Really Unforgiving: No way to override this behavior 4. Undocumented: No mention in the documentation, or it's too hard for me to find */ -$('.form-group').removeClass('row'); From a03db9396c8aa6df1d2c4617abab70cbb6a404bb Mon Sep 17 00:00:00 2001 From: Hendrik Schneider Date: Tue, 10 Jul 2018 22:26:10 +0000 Subject: [PATCH 25/56] Update CONTRIBUTORS.rst --- CONTRIBUTORS.rst | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CONTRIBUTORS.rst b/CONTRIBUTORS.rst index 6b3f0066..e32e556a 100644 --- a/CONTRIBUTORS.rst +++ b/CONTRIBUTORS.rst @@ -99,6 +99,7 @@ Listed in alphabetical order. Garry Polley `@garrypolley`_ Hamish Durkin `@durkode`_ Harry Percival `@hjwp`_ + Hendrik Schneider `@hendrikschneider`_ Henrique G. G. Pereira `@ikkebr`_ Ian Lee `@IanLee1521`_ Jan Van Bruggen `@jvanbrug`_ @@ -209,6 +210,7 @@ Listed in alphabetical order. .. _@goldhand: https://github.com/goldhand .. _@hackebrot: https://github.com/hackebrot .. _@hairychris: https://github.com/hairychris +.. _@hendrikschneider https://github.com/hendrikschneider .. _@hjwp: https://github.com/hjwp .. _@IanLee1521: https://github.com/IanLee1521 .. _@ikkebr: https://github.com/ikkebr From 9932ea3b18fb1ee9eca9e4688516329a41e2f1cf Mon Sep 17 00:00:00 2001 From: Hendrik Schneider Date: Wed, 11 Jul 2018 10:43:19 +0000 Subject: [PATCH 26/56] Update project.js --- .../static/js/project.js | 19 ------------------- 1 file changed, 19 deletions(-) diff --git a/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/static/js/project.js b/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/static/js/project.js index 32280655..d26d23b9 100644 --- a/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/static/js/project.js +++ b/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/static/js/project.js @@ -1,20 +1 @@ /* Project specific Javascript goes here. */ - -/* -Formatting hack to get around crispy-forms unfortunate hardcoding -in helpers.FormHelper: - - if template_pack == 'bootstrap4': - grid_colum_matcher = re.compile('\w*col-(xs|sm|md|lg|xl)-\d+\w*') - using_grid_layout = (grid_colum_matcher.match(self.label_class) or - grid_colum_matcher.match(self.field_class)) - if using_grid_layout: - items['using_grid_layout'] = True - -Issues with the above approach: - -1. Fragile: Assumes Bootstrap 4's API doesn't change (it does) -2. Unforgiving: Doesn't allow for any variation in template design -3. Really Unforgiving: No way to override this behavior -4. Undocumented: No mention in the documentation, or it's too hard for me to find -*/ From 19b75e4dd1530649415573f326aa3e52e8c521b7 Mon Sep 17 00:00:00 2001 From: Bruno Alla Date: Wed, 11 Jul 2018 16:57:43 +0100 Subject: [PATCH 27/56] Upgrade Heroku to the latest Python 3.6.x: 3.6.6 --- {{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 486fcce1..1935e977 100644 --- a/{{cookiecutter.project_slug}}/runtime.txt +++ b/{{cookiecutter.project_slug}}/runtime.txt @@ -1 +1 @@ -python-3.6.5 +python-3.6.6 From 80f6b1958e577addd92d733f65b864491bb77100 Mon Sep 17 00:00:00 2001 From: Mateusz Ostaszewski Date: Thu, 12 Jul 2018 11:35:28 +0200 Subject: [PATCH 28/56] Update bootstrap to 4.1.1 (#1697) * Update Bootstrap to 4.1.1 * Add myself to contributors --- CONTRIBUTORS.rst | 2 ++ README.rst | 2 +- {{cookiecutter.project_slug}}/README.rst | 4 ++-- {{cookiecutter.project_slug}}/package.json | 6 +++--- .../templates/base.html | 12 ++++++------ 5 files changed, 14 insertions(+), 12 deletions(-) diff --git a/CONTRIBUTORS.rst b/CONTRIBUTORS.rst index 6b3f0066..324d1a66 100644 --- a/CONTRIBUTORS.rst +++ b/CONTRIBUTORS.rst @@ -122,6 +122,7 @@ Listed in alphabetical order. Malik Sulaimanov `@flyudvik`_ @flyudvik Martin Blech Martin Saizar `@msaizar`_ + Mateusz Ostaszewski `@mostaszewski`_ Mathijs Hoogland `@MathijsHoogland`_ Matt Braymer-Hayes `@mattayes`_ @mattayes Matt Linares @@ -226,6 +227,7 @@ Listed in alphabetical order. .. _@MathijsHoogland: https://github.com/MathijsHoogland .. _@mattayes: https://github.com/mattayes .. _@menzenski: https://github.com/menzenski +.. _@mostaszewski: https://github.com/mostaszewski .. _@mfwarren: https://github.com/mfwarren .. _@mimischi: https://github.com/mimischi .. _@mjsisley: https://github.com/mjsisley diff --git a/README.rst b/README.rst index a69712d0..b5a3e7c0 100644 --- a/README.rst +++ b/README.rst @@ -41,7 +41,7 @@ Features * For Django 2.0 * Works with Python 3.6 * Renders Django projects with 100% starting test coverage -* Twitter Bootstrap_ v4.0.0 (`maintained Foundation fork`_ also available) +* Twitter Bootstrap_ v4.1.1 (`maintained Foundation fork`_ also available) * 12-Factor_ based settings via django-environ_ * Secure by default. We believe in SSL. * Optimized development and production settings diff --git a/{{cookiecutter.project_slug}}/README.rst b/{{cookiecutter.project_slug}}/README.rst index 3386d985..aef0896a 100644 --- a/{{cookiecutter.project_slug}}/README.rst +++ b/{{cookiecutter.project_slug}}/README.rst @@ -138,7 +138,7 @@ Custom Bootstrap Compilation ^^^^^^ 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``. +Bootstrap v4.1.1 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 source`_, or get explanations on them in the `Bootstrap docs`_. @@ -147,6 +147,6 @@ Bootstrap's javascript as well as its dependencies is concatenated into a single {% 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/ +.. _Bootstrap docs: https://getbootstrap.com/docs/4.1/getting-started/theming/ {% endif %} diff --git a/{{cookiecutter.project_slug}}/package.json b/{{cookiecutter.project_slug}}/package.json index f32c41a2..03a4e6a2 100644 --- a/{{cookiecutter.project_slug}}/package.json +++ b/{{cookiecutter.project_slug}}/package.json @@ -5,7 +5,7 @@ "devDependencies": { {% if cookiecutter.js_task_runner == 'Gulp' %} {% if cookiecutter.custom_bootstrap_compilation == 'y' %} - "bootstrap": "^4.0.0", + "bootstrap": "4.1.1", {% endif %} "browser-sync": "^2.14.0", "del": "^2.2.2", @@ -23,8 +23,8 @@ "gulp-uglify": "^3.0.0", "gulp-util": "^3.0.7", {% if cookiecutter.custom_bootstrap_compilation == 'y' %} - "jquery": "^3.2.1-slim", - "popper.js": "^1.12.3", + "jquery": "3.3.1-slim", + "popper.js": "1.14.3", {% endif %} "run-sequence": "^2.1.1" {% endif %} diff --git a/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/templates/base.html b/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/templates/base.html index 2cb70566..6865c929 100644 --- a/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/templates/base.html +++ b/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/templates/base.html @@ -17,8 +17,8 @@ {% block css %} {% endraw %}{% if cookiecutter.custom_bootstrap_compilation == "n" %}{% raw %} - - + + {% endraw %}{% endif %}{% raw %} @@ -102,10 +102,10 @@ {% endraw %}{% if cookiecutter.use_compressor == "y" %}{% raw %}{% endcompress %}{% endraw %}{% endif %}{% raw %} {% endraw %}{% else %}{% raw %} - - - - + + + + {% endraw %}{% endif %}{% raw %} From e6d33da298e72314768f38374e9dfb19702947e8 Mon Sep 17 00:00:00 2001 From: "pyup.io bot" Date: Fri, 13 Jul 2018 06:05:02 +0200 Subject: [PATCH 29/56] Update tox from 3.1.1 to 3.1.2 (#1718) --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index fca457e7..36c1d8cb 100644 --- a/requirements.txt +++ b/requirements.txt @@ -8,6 +8,6 @@ flake8==3.5.0 # Testing # ------------------------------------------------------------------------------ -tox==3.1.1 +tox==3.1.2 pytest==3.6.3 pytest-cookies==0.3.0 From 399cce6eb72a8f2c609c8b7dd43b7a7c75cffe15 Mon Sep 17 00:00:00 2001 From: "pyup.io bot" Date: Tue, 17 Jul 2018 05:25:36 +0200 Subject: [PATCH 30/56] Update django-extensions to 2.1.0 (#1720) This PR updates [django-extensions](https://pypi.org/project/django-extensions) from **2.0.7** to **2.1.0**.
Changelog ### 2.1.0 ``` Changes: - Fix: travis ``` ### 2.0.9 ``` ----- Changes: - Improvement: use README as project description on PyPI ``` ### 2.0.8 ``` ----- Please stop using ForeignKeyAutocompleteAdmin edition :-) Changes: - Fix: special markers in runserver_plus.rst - Fix: shell_plus, refactor reading pythonrc file outside of exec(compile(...)) - Fix: reset_db, fix default utf8 support - Fix: autoslugfield, Fix autoslug generation when existing model is copied - Improvement: Cleanup management commands options after argparse migration 916 - Improvement: sqldiff, add more tests - Improvement: sqldiff, add DurationField and SearchVectorField - Improvement: shell_plus, add more tests - Improvement: shell_plus, backport macos fix for tab completion - Improvement: clear_cache, add --all option - Improvement: pipchecker, treat dev versions as unstable - Deprecation: ForeignKeyAutocompleteAdmin, Django 2.0 has similar capabilities, which are much better supported. ```
Links - PyPI: https://pypi.org/project/django-extensions - Changelog: https://pyup.io/changelogs/django-extensions/ - Repo: http://github.com/django-extensions/django-extensions
--- {{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 c88fe885..1b6048f8 100644 --- a/{{cookiecutter.project_slug}}/requirements/local.txt +++ b/{{cookiecutter.project_slug}}/requirements/local.txt @@ -24,6 +24,6 @@ coverage==4.5.1 # https://github.com/nedbat/coveragepy factory-boy==2.11.1 # https://github.com/FactoryBoy/factory_boy django-debug-toolbar==1.9.1 # https://github.com/jazzband/django-debug-toolbar -django-extensions==2.0.7 # https://github.com/django-extensions/django-extensions +django-extensions==2.1.0 # https://github.com/django-extensions/django-extensions django-coverage-plugin==1.5.0 # https://github.com/nedbat/django_coverage_plugin pytest-django==3.3.2 # https://github.com/pytest-dev/pytest-django From e34ab9b87594f684ce5223c9b7f7c5b57a6e022d Mon Sep 17 00:00:00 2001 From: "pyup.io bot" Date: Tue, 17 Jul 2018 05:26:04 +0200 Subject: [PATCH 31/56] Update sphinx from 1.7.5 to 1.7.6 (#1719) --- {{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 1b6048f8..b41a7504 100644 --- a/{{cookiecutter.project_slug}}/requirements/local.txt +++ b/{{cookiecutter.project_slug}}/requirements/local.txt @@ -2,7 +2,7 @@ Werkzeug==0.14.1 # https://github.com/pallets/werkzeug ipdb==0.11 # https://github.com/gotcha/ipdb -Sphinx==1.7.5 # https://github.com/sphinx-doc/sphinx +Sphinx==1.7.6 # https://github.com/sphinx-doc/sphinx {%- if cookiecutter.use_docker == 'y' %} psycopg2==2.7.4 --no-binary psycopg2 # https://github.com/psycopg/psycopg2 {%- else %} From 72d6be7883f7afd2b5642cdbd01d28ddeda69b77 Mon Sep 17 00:00:00 2001 From: pyup-bot Date: Wed, 18 Jul 2018 04:03:29 -0700 Subject: [PATCH 32/56] Update celery from 4.2.0 to 4.2.1 --- {{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 9d49be2a..8377d03e 100644 --- a/{{cookiecutter.project_slug}}/requirements/base.txt +++ b/{{cookiecutter.project_slug}}/requirements/base.txt @@ -10,7 +10,7 @@ whitenoise==3.3.1 # https://github.com/evansd/whitenoise {%- endif %} redis>=2.10.5 # https://github.com/antirez/redis {%- if cookiecutter.use_celery == "y" %} -celery==4.2.0 # pyup: <5.0 # https://github.com/celery/celery +celery==4.2.1 # pyup: <5.0 # https://github.com/celery/celery {%- if cookiecutter.use_docker == 'y' %} flower==0.9.2 # https://github.com/mher/flower {%- endif %} From 61be16a867e106f61db298afbb94c8c5ea2349f2 Mon Sep 17 00:00:00 2001 From: John Cass Date: Wed, 18 Jul 2018 17:15:44 +0200 Subject: [PATCH 33/56] Update test coverage command for usage with py.test. --- CONTRIBUTORS.rst | 3 ++- {{cookiecutter.project_slug}}/README.rst | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/CONTRIBUTORS.rst b/CONTRIBUTORS.rst index e9f79609..814395b4 100644 --- a/CONTRIBUTORS.rst +++ b/CONTRIBUTORS.rst @@ -105,6 +105,7 @@ Listed in alphabetical order. Jan Van Bruggen `@jvanbrug`_ Jens Nilsson `@phiberjenz`_ Jimmy Gitonga `@afrowave`_ @afrowave + John Cass `@jcass77`_ @cass_john Julien Almarcha `@sladinji`_ Julio Castillo `@juliocc`_ Kaido Kert `@kaidokert`_ @@ -164,7 +165,7 @@ Listed in alphabetical order. Will Farley `@goldhand`_ @g01dhand William Archinal `@archinal`_ Yaroslav Halchenko - Denis Bobrov `@delneg`_ + Denis Bobrov `@delneg`_ ========================== ============================ ============== .. _@a7p: https://github.com/a7p diff --git a/{{cookiecutter.project_slug}}/README.rst b/{{cookiecutter.project_slug}}/README.rst index aef0896a..80e4aa92 100644 --- a/{{cookiecutter.project_slug}}/README.rst +++ b/{{cookiecutter.project_slug}}/README.rst @@ -37,7 +37,7 @@ Test coverage To run the tests, check your test coverage, and generate an HTML coverage report:: - $ coverage run manage.py test + $ coverage run -m pytest $ coverage html $ open htmlcov/index.html From bb01d961edb73848c29f387974dd89ca639d446b Mon Sep 17 00:00:00 2001 From: John Cass Date: Mon, 23 Jul 2018 08:51:06 +0200 Subject: [PATCH 34/56] Use pytest's recommended command as the entry point for running tests. --- tests/test_docker.sh | 2 +- {{cookiecutter.project_slug}}/README.rst | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/test_docker.sh b/tests/test_docker.sh index bebac148..78c5717a 100755 --- a/tests/test_docker.sh +++ b/tests/test_docker.sh @@ -15,7 +15,7 @@ cookiecutter ../../ --no-input --overwrite-if-exists use_docker=y cd my_awesome_project # run the project's tests -docker-compose -f local.yml run django python manage.py test +docker-compose -f local.yml run django python manage.py pytest # return non-zero status code if there are migrations that have not been created docker-compose -f local.yml run django python manage.py makemigrations --dry-run --check || { echo "ERROR: there were changes in the models, but migration listed above have not been created and are not saved in version control"; exit 1; } diff --git a/{{cookiecutter.project_slug}}/README.rst b/{{cookiecutter.project_slug}}/README.rst index 80e4aa92..c282f73a 100644 --- a/{{cookiecutter.project_slug}}/README.rst +++ b/{{cookiecutter.project_slug}}/README.rst @@ -46,7 +46,7 @@ Running tests with py.test :: - $ py.test + $ pytest Live reloading and Sass CSS compilation ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ From 55debd5b6b6aa72ba29309960430426f9d97b9e8 Mon Sep 17 00:00:00 2001 From: "pyup.io bot" Date: Fri, 27 Jul 2018 04:21:45 +0200 Subject: [PATCH 35/56] Update pytest-django to 3.3.3 (#1728) This PR updates [pytest-django](https://pypi.org/project/pytest-django) from **3.3.2** to **3.3.3**.
Changelog ### 3.3.3 ``` ------------------ Bug fixes ^^^^^^^^^ * Fixed registration of :py:func:`~pytest.mark.ignore_template_errors` marker, which is required with ``pytest --strict`` (609). * Fixed another regression with unittest (624, 625). Docs ^^^^ * Use sphinx_rtf_theme (621). * Minor fixes. ```
Links - PyPI: https://pypi.org/project/pytest-django - Changelog: https://pyup.io/changelogs/pytest-django/ - Docs: https://pytest-django.readthedocs.io/
--- {{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 b41a7504..18d17a4c 100644 --- a/{{cookiecutter.project_slug}}/requirements/local.txt +++ b/{{cookiecutter.project_slug}}/requirements/local.txt @@ -26,4 +26,4 @@ factory-boy==2.11.1 # https://github.com/FactoryBoy/factory_boy django-debug-toolbar==1.9.1 # https://github.com/jazzband/django-debug-toolbar django-extensions==2.1.0 # https://github.com/django-extensions/django-extensions django-coverage-plugin==1.5.0 # https://github.com/nedbat/django_coverage_plugin -pytest-django==3.3.2 # https://github.com/pytest-dev/pytest-django +pytest-django==3.3.3 # https://github.com/pytest-dev/pytest-django From 6c2a130e3db8d8e55ab1a7160321555ac9408e81 Mon Sep 17 00:00:00 2001 From: "pyup.io bot" Date: Sun, 29 Jul 2018 13:12:41 +0200 Subject: [PATCH 36/56] Update pytest to 3.6.4 (#1731) * Update pytest from 3.6.3 to 3.6.4 * Update pytest from 3.6.3 to 3.6.4 --- requirements.txt | 2 +- {{cookiecutter.project_slug}}/requirements/local.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/requirements.txt b/requirements.txt index 36c1d8cb..0500c18f 100644 --- a/requirements.txt +++ b/requirements.txt @@ -9,5 +9,5 @@ flake8==3.5.0 # Testing # ------------------------------------------------------------------------------ tox==3.1.2 -pytest==3.6.3 +pytest==3.6.4 pytest-cookies==0.3.0 diff --git a/{{cookiecutter.project_slug}}/requirements/local.txt b/{{cookiecutter.project_slug}}/requirements/local.txt index 18d17a4c..c7f54b49 100644 --- a/{{cookiecutter.project_slug}}/requirements/local.txt +++ b/{{cookiecutter.project_slug}}/requirements/local.txt @@ -11,7 +11,7 @@ psycopg2-binary==2.7.5 # https://github.com/psycopg/psycopg2 # Testing # ------------------------------------------------------------------------------ -pytest==3.6.3 # https://github.com/pytest-dev/pytest +pytest==3.6.4 # https://github.com/pytest-dev/pytest pytest-sugar==0.9.1 # https://github.com/Frozenball/pytest-sugar # Code quality From dc1119591708af709788f5902dcd966491741ac1 Mon Sep 17 00:00:00 2001 From: "pyup.io bot" Date: Thu, 2 Aug 2018 02:17:27 +0200 Subject: [PATCH 37/56] Update django to 2.0.8 (#1734) This PR updates [django](https://pypi.org/project/django) from **2.0.7** to **2.0.8**.
Changelog ### 2.0.8 ``` ========================== *August 1, 2018* Django 2.0.8 fixes a security issue and several bugs in 2.0.7. CVE-2018-14574: Open redirect possibility in ``CommonMiddleware`` ================================================================= If the :class:`~django.middleware.common.CommonMiddleware` and the :setting:`APPEND_SLASH` setting are both enabled, and if the project has a URL pattern that accepts any path ending in a slash (many content management systems have such a pattern), then a request to a maliciously crafted URL of that site could lead to a redirect to another site, enabling phishing and other attacks. ``CommonMiddleware`` now escapes leading slashes to prevent redirects to other domains. Bugfixes ======== * Fixed a regression in Django 2.0.7 that broke the ``regex`` lookup on MariaDB (even though MariaDB isn't officially supported) (:ticket:`29544`). * Fixed a regression where ``django.template.Template`` crashed if the ``template_string`` argument is lazy (:ticket:`29617`). ========================== ```
Links - PyPI: https://pypi.org/project/django - Changelog: https://pyup.io/changelogs/django/ - Homepage: https://www.djangoproject.com/
--- {{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 8377d03e..dbaf83fe 100644 --- a/{{cookiecutter.project_slug}}/requirements/base.txt +++ b/{{cookiecutter.project_slug}}/requirements/base.txt @@ -18,7 +18,7 @@ flower==0.9.2 # https://github.com/mher/flower # Django # ------------------------------------------------------------------------------ -django==2.0.7 # pyup: < 2.1 # https://www.djangoproject.com/ +django==2.0.8 # pyup: < 2.1 # https://www.djangoproject.com/ django-environ==0.4.5 # https://github.com/joke2k/django-environ django-model-utils==3.1.2 # https://github.com/jazzband/django-model-utils django-allauth==0.36.0 # https://github.com/pennersr/django-allauth From 0aa761ef45029e23a33b1e2c2be392a301a068fc Mon Sep 17 00:00:00 2001 From: pyup-bot Date: Fri, 3 Aug 2018 02:04:59 -0700 Subject: [PATCH 38/56] Update pytest from 3.6.4 to 3.7.1 --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 0500c18f..928cc2ff 100644 --- a/requirements.txt +++ b/requirements.txt @@ -9,5 +9,5 @@ flake8==3.5.0 # Testing # ------------------------------------------------------------------------------ tox==3.1.2 -pytest==3.6.4 +pytest==3.7.1 pytest-cookies==0.3.0 From d78978abd5ffbca3042586475f228cfd1b2a8437 Mon Sep 17 00:00:00 2001 From: pyup-bot Date: Fri, 3 Aug 2018 02:05:01 -0700 Subject: [PATCH 39/56] Update pytest from 3.6.4 to 3.7.1 --- {{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 c7f54b49..a53e0618 100644 --- a/{{cookiecutter.project_slug}}/requirements/local.txt +++ b/{{cookiecutter.project_slug}}/requirements/local.txt @@ -11,7 +11,7 @@ psycopg2-binary==2.7.5 # https://github.com/psycopg/psycopg2 # Testing # ------------------------------------------------------------------------------ -pytest==3.6.4 # https://github.com/pytest-dev/pytest +pytest==3.7.1 # https://github.com/pytest-dev/pytest pytest-sugar==0.9.1 # https://github.com/Frozenball/pytest-sugar # Code quality From 7401be4de077a8f7558df7586ddf6e11dcbf4db4 Mon Sep 17 00:00:00 2001 From: pyup-bot Date: Sat, 4 Aug 2018 03:40:02 -0500 Subject: [PATCH 40/56] Update tox from 3.1.2 to 3.1.3 --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 928cc2ff..7975aafd 100644 --- a/requirements.txt +++ b/requirements.txt @@ -8,6 +8,6 @@ flake8==3.5.0 # Testing # ------------------------------------------------------------------------------ -tox==3.1.2 +tox==3.1.3 pytest==3.7.1 pytest-cookies==0.3.0 From 0a858bf512affa264e1a16bd9746e3f527213800 Mon Sep 17 00:00:00 2001 From: Diane DeMers Chen Date: Mon, 13 Aug 2018 05:57:28 -0700 Subject: [PATCH 41/56] Add note about using keep_local_envs_in_vcs (#1735) * Add note about using keep_local_envs_in_vcs As a newbie, I wasn't sure about `keep_local_envs_in_vcs`, so I said yes, and when CC was building, it gave me the message: "[INFO]: .env(s) are only utilized when Docker Compose and/or Heroku support is enabled so keeping them does not make sense given your current setup." Seems like it could go in this documentation, and make things easier for newbies. * Add me to CONTRIBUTORS.RST --- CONTRIBUTORS.rst | 2 ++ docs/project-generation-options.rst | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/CONTRIBUTORS.rst b/CONTRIBUTORS.rst index 814395b4..bbbfaf9a 100644 --- a/CONTRIBUTORS.rst +++ b/CONTRIBUTORS.rst @@ -89,6 +89,7 @@ Listed in alphabetical order. Delio Castillo `@jangeador`_ @jangeador Denis Orehovsky `@apirobot`_ Dónal Adams `@epileptic-fish`_ + Diane Chen `@purplediane`_ @purplediane88 Dong Huynh `@trungdong`_ Emanuel Calso `@bloodpet`_ @bloodpet Eraldo Energy `@eraldo`_ @@ -272,6 +273,7 @@ Listed in alphabetical order. .. _@afrowave: https://github.com/afrowave .. _@pchiquet: https://github.com/pchiquet .. _@delneg: https://github.com/delneg +.. _@purplediane: https://github.com/purplediane Special Thanks ~~~~~~~~~~~~~~ diff --git a/docs/project-generation-options.rst b/docs/project-generation-options.rst index 60453b87..a5483797 100644 --- a/docs/project-generation-options.rst +++ b/docs/project-generation-options.rst @@ -93,7 +93,8 @@ use_travisci: keep_local_envs_in_vcs: Indicates whether the project's ``.envs/.local/`` should be kept in VCS (comes in handy when working in teams where local environment reproducibility - is strongly encouraged). + is strongly encouraged). + Note: .env(s) are only utilized when Docker Compose and/or Heroku support is enabled. debug: Indicates whether the project should be configured for debugging. From d726202cae5fc129964b4e67ac90ed50cb245879 Mon Sep 17 00:00:00 2001 From: "pyup.io bot" Date: Mon, 13 Aug 2018 15:02:24 +0200 Subject: [PATCH 42/56] Update tox from 3.1.3 to 3.2.1 (#1744) --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 7975aafd..f2ff57d1 100644 --- a/requirements.txt +++ b/requirements.txt @@ -8,6 +8,6 @@ flake8==3.5.0 # Testing # ------------------------------------------------------------------------------ -tox==3.1.3 +tox==3.2.1 pytest==3.7.1 pytest-cookies==0.3.0 From 36f3558ccc934e19ba54cfe16c92abb5d720b5bd Mon Sep 17 00:00:00 2001 From: "pyup.io bot" Date: Mon, 13 Aug 2018 15:06:42 +0200 Subject: [PATCH 43/56] Update whitenoise from 3.3.1 to 4.0 (#1745) --- {{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 dbaf83fe..68d8ddd7 100644 --- a/{{cookiecutter.project_slug}}/requirements/base.txt +++ b/{{cookiecutter.project_slug}}/requirements/base.txt @@ -6,7 +6,7 @@ rcssmin==1.0.6{% if cookiecutter.windows == 'y' %} --install-option="--without-c {%- endif %} argon2-cffi==18.1.0 # https://github.com/hynek/argon2_cffi {%- if cookiecutter.use_whitenoise == 'y' %} -whitenoise==3.3.1 # https://github.com/evansd/whitenoise +whitenoise==4.0 # https://github.com/evansd/whitenoise {%- endif %} redis>=2.10.5 # https://github.com/antirez/redis {%- if cookiecutter.use_celery == "y" %} From b8f6f43a606458fc79adeca15a23528c47a852fa Mon Sep 17 00:00:00 2001 From: "pyup.io bot" Date: Thu, 16 Aug 2018 18:17:04 -0700 Subject: [PATCH 44/56] Update pytest-django to 3.4.1 (#1753) This PR updates [pytest-django](https://pypi.org/project/pytest-django) from **3.3.3** to **3.4.1**.
Changelog ### 3.4.0 ``` ------------------ Features ^^^^^^^^ * Added new fixture :fixture:`django_assert_max_num_queries` (547). * Added support for ``connection`` and returning the wrapped context manager with :fixture:`django_assert_num_queries` (547). * Added support for resetting sequences via :fixture:`django_db_reset_sequences` (619). Bugfixes ^^^^^^^^ * Made sure to not call django.setup() multiple times (629, 531). Compatibility ^^^^^^^^^^^^^ * Removed py dependency, use pathlib instead (631). ```
Links - PyPI: https://pypi.org/project/pytest-django - Changelog: https://pyup.io/changelogs/pytest-django/ - Docs: https://pytest-django.readthedocs.io/
--- {{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 a53e0618..d53966c3 100644 --- a/{{cookiecutter.project_slug}}/requirements/local.txt +++ b/{{cookiecutter.project_slug}}/requirements/local.txt @@ -26,4 +26,4 @@ factory-boy==2.11.1 # https://github.com/FactoryBoy/factory_boy django-debug-toolbar==1.9.1 # https://github.com/jazzband/django-debug-toolbar django-extensions==2.1.0 # https://github.com/django-extensions/django-extensions django-coverage-plugin==1.5.0 # https://github.com/nedbat/django_coverage_plugin -pytest-django==3.3.3 # https://github.com/pytest-dev/pytest-django +pytest-django==3.4.1 # https://github.com/pytest-dev/pytest-django From eb8e2a33c8df870cdb8ca19cdd16d7d94831fe20 Mon Sep 17 00:00:00 2001 From: "pyup.io bot" Date: Sat, 18 Aug 2018 22:19:11 -0700 Subject: [PATCH 45/56] Update pytest to 3.7.2 (#1755) This PR updates [pytest](https://pypi.org/project/pytest) from **3.7.1** to **3.7.2**.
Changelog ### 3.7.2 ``` ========================= Bug Fixes --------- - `3671 <https://github.com/pytest-dev/pytest/issues/3671>`_: Fix ``filterwarnings`` not being registered as a builtin mark. - `3768 <https://github.com/pytest-dev/pytest/issues/3768>`_, `3789 <https://github.com/pytest-dev/pytest/issues/3789>`_: Fix test collection from packages mixed with normal directories. - `3771 <https://github.com/pytest-dev/pytest/issues/3771>`_: Fix infinite recursion during collection if a ``pytest_ignore_collect`` hook returns ``False`` instead of ``None``. - `3774 <https://github.com/pytest-dev/pytest/issues/3774>`_: Fix bug where decorated fixtures would lose functionality (for example ``mock.patch``). - `3775 <https://github.com/pytest-dev/pytest/issues/3775>`_: Fix bug where importing modules or other objects with prefix ``pytest_`` prefix would raise a ``PluginValidationError``. - `3788 <https://github.com/pytest-dev/pytest/issues/3788>`_: Fix ``AttributeError`` during teardown of ``TestCase`` subclasses which raise an exception during ``__init__``. - `3804 <https://github.com/pytest-dev/pytest/issues/3804>`_: Fix traceback reporting for exceptions with ``__cause__`` cycles. Improved Documentation ---------------------- - `3746 <https://github.com/pytest-dev/pytest/issues/3746>`_: Add documentation for ``metafunc.config`` that had been mistakenly hidden. ```
Links - PyPI: https://pypi.org/project/pytest - Changelog: https://pyup.io/changelogs/pytest/ - Homepage: http://pytest.org
--- requirements.txt | 2 +- {{cookiecutter.project_slug}}/requirements/local.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/requirements.txt b/requirements.txt index f2ff57d1..2d40d6c9 100644 --- a/requirements.txt +++ b/requirements.txt @@ -9,5 +9,5 @@ flake8==3.5.0 # Testing # ------------------------------------------------------------------------------ tox==3.2.1 -pytest==3.7.1 +pytest==3.7.2 pytest-cookies==0.3.0 diff --git a/{{cookiecutter.project_slug}}/requirements/local.txt b/{{cookiecutter.project_slug}}/requirements/local.txt index d53966c3..c96913db 100644 --- a/{{cookiecutter.project_slug}}/requirements/local.txt +++ b/{{cookiecutter.project_slug}}/requirements/local.txt @@ -11,7 +11,7 @@ psycopg2-binary==2.7.5 # https://github.com/psycopg/psycopg2 # Testing # ------------------------------------------------------------------------------ -pytest==3.7.1 # https://github.com/pytest-dev/pytest +pytest==3.7.2 # https://github.com/pytest-dev/pytest pytest-sugar==0.9.1 # https://github.com/Frozenball/pytest-sugar # Code quality From 44b924b54f97ed4bc7f050a557fcb445e86d506f Mon Sep 17 00:00:00 2001 From: "pyup.io bot" Date: Sun, 19 Aug 2018 03:20:31 -0700 Subject: [PATCH 46/56] Update argon2-cffi from 18.1.0 to 18.2.0 (#1756) --- {{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 68d8ddd7..846e8c18 100644 --- a/{{cookiecutter.project_slug}}/requirements/base.txt +++ b/{{cookiecutter.project_slug}}/requirements/base.txt @@ -4,7 +4,7 @@ Pillow==5.2.0 # https://github.com/python-pillow/Pillow {%- if cookiecutter.use_compressor == "y" %} rcssmin==1.0.6{% if cookiecutter.windows == 'y' %} --install-option="--without-c-extensions"{% endif %} # https://github.com/ndparker/rcssmin {%- endif %} -argon2-cffi==18.1.0 # https://github.com/hynek/argon2_cffi +argon2-cffi==18.2.0 # https://github.com/hynek/argon2_cffi {%- if cookiecutter.use_whitenoise == 'y' %} whitenoise==4.0 # https://github.com/evansd/whitenoise {%- endif %} From c18a2fca8c5ddc5cf458f4f473bb07b036aed2e4 Mon Sep 17 00:00:00 2001 From: Denis Orehovsky Date: Sun, 19 Aug 2018 14:08:29 +0300 Subject: [PATCH 47/56] Run type checks in test_docker --- tests/test_docker.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/test_docker.sh b/tests/test_docker.sh index 78c5717a..0fd81604 100755 --- a/tests/test_docker.sh +++ b/tests/test_docker.sh @@ -14,6 +14,9 @@ cd .cache/docker cookiecutter ../../ --no-input --overwrite-if-exists use_docker=y cd my_awesome_project +# run the project's type checks +docker-compose -f local.yml run django mypy my_awesome_project + # run the project's tests docker-compose -f local.yml run django python manage.py pytest From 80e0862ff009e27e948138f66861b1db46e74686 Mon Sep 17 00:00:00 2001 From: Denis Orehovsky Date: Sun, 19 Aug 2018 14:22:33 +0300 Subject: [PATCH 48/56] Fix running tests in test_docker.sh file --- tests/test_docker.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_docker.sh b/tests/test_docker.sh index 78c5717a..63a2f199 100755 --- a/tests/test_docker.sh +++ b/tests/test_docker.sh @@ -15,7 +15,7 @@ cookiecutter ../../ --no-input --overwrite-if-exists use_docker=y cd my_awesome_project # run the project's tests -docker-compose -f local.yml run django python manage.py pytest +docker-compose -f local.yml run django pytest # return non-zero status code if there are migrations that have not been created docker-compose -f local.yml run django python manage.py makemigrations --dry-run --check || { echo "ERROR: there were changes in the models, but migration listed above have not been created and are not saved in version control"; exit 1; } From e81f7abbd76ed519e73d5ef325b53355ebef03fd Mon Sep 17 00:00:00 2001 From: "pyup.io bot" Date: Sun, 19 Aug 2018 06:05:42 -0700 Subject: [PATCH 49/56] Update argon2-cffi from 18.2.0 to 18.3.0 (#1758) --- {{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 846e8c18..e3737aae 100644 --- a/{{cookiecutter.project_slug}}/requirements/base.txt +++ b/{{cookiecutter.project_slug}}/requirements/base.txt @@ -4,7 +4,7 @@ Pillow==5.2.0 # https://github.com/python-pillow/Pillow {%- if cookiecutter.use_compressor == "y" %} rcssmin==1.0.6{% if cookiecutter.windows == 'y' %} --install-option="--without-c-extensions"{% endif %} # https://github.com/ndparker/rcssmin {%- endif %} -argon2-cffi==18.2.0 # https://github.com/hynek/argon2_cffi +argon2-cffi==18.3.0 # https://github.com/hynek/argon2_cffi {%- if cookiecutter.use_whitenoise == 'y' %} whitenoise==4.0 # https://github.com/evansd/whitenoise {%- endif %} From 7485ac28be07e5c1c123dcf35b40ed770ca9a308 Mon Sep 17 00:00:00 2001 From: "pyup.io bot" Date: Mon, 20 Aug 2018 12:35:24 -0700 Subject: [PATCH 50/56] Update pytest-django from 3.4.1 to 3.4.2 (#1760) --- {{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 c96913db..691f76c6 100644 --- a/{{cookiecutter.project_slug}}/requirements/local.txt +++ b/{{cookiecutter.project_slug}}/requirements/local.txt @@ -26,4 +26,4 @@ factory-boy==2.11.1 # https://github.com/FactoryBoy/factory_boy django-debug-toolbar==1.9.1 # https://github.com/jazzband/django-debug-toolbar django-extensions==2.1.0 # https://github.com/django-extensions/django-extensions django-coverage-plugin==1.5.0 # https://github.com/nedbat/django_coverage_plugin -pytest-django==3.4.1 # https://github.com/pytest-dev/pytest-django +pytest-django==3.4.2 # https://github.com/pytest-dev/pytest-django From d95bdc6a378062382c536da07364bf8c46f8ea9c Mon Sep 17 00:00:00 2001 From: "pyup.io bot" Date: Thu, 23 Aug 2018 01:30:49 -0700 Subject: [PATCH 51/56] Update sphinx from 1.7.6 to 1.7.7 (#1759) --- {{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 691f76c6..9eeb4066 100644 --- a/{{cookiecutter.project_slug}}/requirements/local.txt +++ b/{{cookiecutter.project_slug}}/requirements/local.txt @@ -2,7 +2,7 @@ Werkzeug==0.14.1 # https://github.com/pallets/werkzeug ipdb==0.11 # https://github.com/gotcha/ipdb -Sphinx==1.7.6 # https://github.com/sphinx-doc/sphinx +Sphinx==1.7.7 # https://github.com/sphinx-doc/sphinx {%- if cookiecutter.use_docker == 'y' %} psycopg2==2.7.4 --no-binary psycopg2 # https://github.com/psycopg/psycopg2 {%- else %} From 967bdb89c3ba212b876c87dfdac21dbed9cbe762 Mon Sep 17 00:00:00 2001 From: "pyup.io bot" Date: Mon, 27 Aug 2018 12:56:08 -0700 Subject: [PATCH 52/56] Update pytest to 3.7.3 (#1764) * Update pytest from 3.7.2 to 3.7.3 * Update pytest from 3.7.2 to 3.7.3 --- requirements.txt | 2 +- {{cookiecutter.project_slug}}/requirements/local.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/requirements.txt b/requirements.txt index 2d40d6c9..5d710316 100644 --- a/requirements.txt +++ b/requirements.txt @@ -9,5 +9,5 @@ flake8==3.5.0 # Testing # ------------------------------------------------------------------------------ tox==3.2.1 -pytest==3.7.2 +pytest==3.7.3 pytest-cookies==0.3.0 diff --git a/{{cookiecutter.project_slug}}/requirements/local.txt b/{{cookiecutter.project_slug}}/requirements/local.txt index 9eeb4066..47e99bcc 100644 --- a/{{cookiecutter.project_slug}}/requirements/local.txt +++ b/{{cookiecutter.project_slug}}/requirements/local.txt @@ -11,7 +11,7 @@ psycopg2-binary==2.7.5 # https://github.com/psycopg/psycopg2 # Testing # ------------------------------------------------------------------------------ -pytest==3.7.2 # https://github.com/pytest-dev/pytest +pytest==3.7.3 # https://github.com/pytest-dev/pytest pytest-sugar==0.9.1 # https://github.com/Frozenball/pytest-sugar # Code quality From 95f543878725d4d2beb5ed89687a19eb18b7cf6a Mon Sep 17 00:00:00 2001 From: "pyup.io bot" Date: Mon, 27 Aug 2018 18:22:54 -0700 Subject: [PATCH 53/56] Update django-extensions to 2.1.2 (#1770) This PR updates [django-extensions](https://pypi.org/project/django-extensions) from **2.1.0** to **2.1.2**.
Changelog ### 2.1.2 ``` ----- Changes: - Fix: AutoSlugField, fix check on list or tuple type ``` ### 2.1.1 ``` ----- ```
Links - PyPI: https://pypi.org/project/django-extensions - Changelog: https://pyup.io/changelogs/django-extensions/ - Repo: http://github.com/django-extensions/django-extensions
--- {{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 47e99bcc..313e510c 100644 --- a/{{cookiecutter.project_slug}}/requirements/local.txt +++ b/{{cookiecutter.project_slug}}/requirements/local.txt @@ -24,6 +24,6 @@ coverage==4.5.1 # https://github.com/nedbat/coveragepy factory-boy==2.11.1 # https://github.com/FactoryBoy/factory_boy django-debug-toolbar==1.9.1 # https://github.com/jazzband/django-debug-toolbar -django-extensions==2.1.0 # https://github.com/django-extensions/django-extensions +django-extensions==2.1.2 # https://github.com/django-extensions/django-extensions django-coverage-plugin==1.5.0 # https://github.com/nedbat/django_coverage_plugin pytest-django==3.4.2 # https://github.com/pytest-dev/pytest-django From 53945865d68a4cc8aa3f4a86d6da6609df4fc352 Mon Sep 17 00:00:00 2001 From: "pyup.io bot" Date: Mon, 27 Aug 2018 18:24:02 -0700 Subject: [PATCH 54/56] Update django-allauth from 0.36.0 to 0.37.1 (#1768) --- {{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 e3737aae..510ab376 100644 --- a/{{cookiecutter.project_slug}}/requirements/base.txt +++ b/{{cookiecutter.project_slug}}/requirements/base.txt @@ -21,7 +21,7 @@ flower==0.9.2 # https://github.com/mher/flower django==2.0.8 # pyup: < 2.1 # https://www.djangoproject.com/ django-environ==0.4.5 # https://github.com/joke2k/django-environ django-model-utils==3.1.2 # https://github.com/jazzband/django-model-utils -django-allauth==0.36.0 # https://github.com/pennersr/django-allauth +django-allauth==0.37.1 # https://github.com/pennersr/django-allauth django-crispy-forms==1.7.2 # https://github.com/django-crispy-forms/django-crispy-forms {%- if cookiecutter.use_compressor == "y" %} django-compressor==2.2 # https://github.com/django-compressor/django-compressor From 217976a8da5ebd7ba920267bffd9592a9665c3da Mon Sep 17 00:00:00 2001 From: "pyup.io bot" Date: Mon, 27 Aug 2018 20:01:58 -0700 Subject: [PATCH 55/56] Update django-anymail from 3.0 to 4.1 (#1769) --- {{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 d3b18ed9..21fe5bc4 100644 --- a/{{cookiecutter.project_slug}}/requirements/production.txt +++ b/{{cookiecutter.project_slug}}/requirements/production.txt @@ -14,4 +14,4 @@ raven==6.9.0 # https://github.com/getsentry/raven-python # Django # ------------------------------------------------------------------------------ django-storages[boto3]==1.6.6 # https://github.com/jschneier/django-storages -django-anymail[mailgun]==3.0 # https://github.com/anymail/django-anymail +django-anymail[mailgun]==4.1 # https://github.com/anymail/django-anymail From 4a090b86722eff4028fa848e4bb8db092fe3e2a5 Mon Sep 17 00:00:00 2001 From: "pyup.io bot" Date: Tue, 28 Aug 2018 17:53:58 -0700 Subject: [PATCH 56/56] Update sphinx to 1.7.8 (#1772) This PR updates [Sphinx](https://pypi.org/project/Sphinx) from **1.7.7** to **1.7.8**.
Changelog ### 1.7.8 ``` ===================================== Incompatible changes -------------------- * The type of ``env.included`` has been changed to dict of set Bugs fixed ---------- * 5320: intersphinx: crashed if invalid url given * 5326: manpage: crashed when invalid docname is specified as ``man_pages`` * 5322: autodoc: ``Any`` typehint causes formatting error * 5327: "document isn't included in any toctree" warning on rebuild with generated files * 5335: quickstart: escape sequence has been displayed with MacPorts' python ```
Links - PyPI: https://pypi.org/project/sphinx - Changelog: https://pyup.io/changelogs/sphinx/ - Homepage: http://sphinx-doc.org/
--- {{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 313e510c..6e84beb1 100644 --- a/{{cookiecutter.project_slug}}/requirements/local.txt +++ b/{{cookiecutter.project_slug}}/requirements/local.txt @@ -2,7 +2,7 @@ Werkzeug==0.14.1 # https://github.com/pallets/werkzeug ipdb==0.11 # https://github.com/gotcha/ipdb -Sphinx==1.7.7 # https://github.com/sphinx-doc/sphinx +Sphinx==1.7.8 # https://github.com/sphinx-doc/sphinx {%- if cookiecutter.use_docker == 'y' %} psycopg2==2.7.4 --no-binary psycopg2 # https://github.com/psycopg/psycopg2 {%- else %}