From dfd1ee8bb2fd62fdf40fa60aa14821263bd98f94 Mon Sep 17 00:00:00 2001 From: Andrew-Chen-Wang Date: Wed, 29 Apr 2020 16:31:19 -0400 Subject: [PATCH 1/4] Use hiredis --- {{cookiecutter.project_slug}}/config/settings/production.py | 1 + {{cookiecutter.project_slug}}/requirements/base.txt | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/{{cookiecutter.project_slug}}/config/settings/production.py b/{{cookiecutter.project_slug}}/config/settings/production.py index c13f1aeb..6edc4ada 100644 --- a/{{cookiecutter.project_slug}}/config/settings/production.py +++ b/{{cookiecutter.project_slug}}/config/settings/production.py @@ -36,6 +36,7 @@ CACHES = { # Mimicing memcache behavior. # http://jazzband.github.io/django-redis/latest/#_memcached_exceptions_behavior "IGNORE_EXCEPTIONS": True, + "PARSER_CLASS": "redis.connection.HiredisParser", }, } } diff --git a/{{cookiecutter.project_slug}}/requirements/base.txt b/{{cookiecutter.project_slug}}/requirements/base.txt index c2d5babf..1783c8c1 100644 --- a/{{cookiecutter.project_slug}}/requirements/base.txt +++ b/{{cookiecutter.project_slug}}/requirements/base.txt @@ -8,7 +8,8 @@ argon2-cffi==19.2.0 # https://github.com/hynek/argon2_cffi {%- if cookiecutter.use_whitenoise == 'y' %} whitenoise==5.0.1 # https://github.com/evansd/whitenoise {%- endif %} -redis==3.4.1 # https://github.com/andymccurdy/redis-py +redis==3.4.1 # https://github.com/andymccurdy/redis-py +hiredis==1.0.1 # https://github.com/redis/hiredis-py {%- if cookiecutter.use_celery == "y" %} celery==4.4.2 # pyup: < 5.0 # https://github.com/celery/celery django-celery-beat==2.0.0 # https://github.com/celery/django-celery-beat From 4d54dcaa3218327b851dcbef03d50225dc3a4cf3 Mon Sep 17 00:00:00 2001 From: Andrew-Chen-Wang Date: Wed, 29 Apr 2020 16:42:24 -0400 Subject: [PATCH 2/4] Put hiredis in production only if using Win --- {{cookiecutter.project_slug}}/requirements/base.txt | 2 ++ {{cookiecutter.project_slug}}/requirements/production.txt | 3 +++ 2 files changed, 5 insertions(+) diff --git a/{{cookiecutter.project_slug}}/requirements/base.txt b/{{cookiecutter.project_slug}}/requirements/base.txt index 1783c8c1..0455e749 100644 --- a/{{cookiecutter.project_slug}}/requirements/base.txt +++ b/{{cookiecutter.project_slug}}/requirements/base.txt @@ -9,7 +9,9 @@ argon2-cffi==19.2.0 # https://github.com/hynek/argon2_cffi whitenoise==5.0.1 # https://github.com/evansd/whitenoise {%- endif %} redis==3.4.1 # https://github.com/andymccurdy/redis-py +{%- if cookiecutter.windows == "n" %} hiredis==1.0.1 # https://github.com/redis/hiredis-py +{%- endif %} {%- if cookiecutter.use_celery == "y" %} celery==4.4.2 # pyup: < 5.0 # https://github.com/celery/celery django-celery-beat==2.0.0 # https://github.com/celery/django-celery-beat diff --git a/{{cookiecutter.project_slug}}/requirements/production.txt b/{{cookiecutter.project_slug}}/requirements/production.txt index b45afb66..51389345 100644 --- a/{{cookiecutter.project_slug}}/requirements/production.txt +++ b/{{cookiecutter.project_slug}}/requirements/production.txt @@ -12,6 +12,9 @@ Collectfast==2.1.0 # https://github.com/antonagestam/collectfast {%- if cookiecutter.use_sentry == "y" %} sentry-sdk==0.14.3 # https://github.com/getsentry/sentry-python {%- endif %} +{%- if cookiecutter.windows == "y" %} +hiredis==1.0.1 # https://github.com/redis/hiredis-py +{%- endif %} # Django # ------------------------------------------------------------------------------ From bf5f557d2b1f3e9ff784e2aae3b357a34df3e722 Mon Sep 17 00:00:00 2001 From: Andrew-Chen-Wang Date: Fri, 1 May 2020 10:35:20 -0400 Subject: [PATCH 3/4] Added docker parameter to hiredis requirement --- {{cookiecutter.project_slug}}/config/settings/production.py | 1 - {{cookiecutter.project_slug}}/requirements/base.txt | 2 +- {{cookiecutter.project_slug}}/requirements/production.txt | 2 +- 3 files changed, 2 insertions(+), 3 deletions(-) diff --git a/{{cookiecutter.project_slug}}/config/settings/production.py b/{{cookiecutter.project_slug}}/config/settings/production.py index 6edc4ada..c13f1aeb 100644 --- a/{{cookiecutter.project_slug}}/config/settings/production.py +++ b/{{cookiecutter.project_slug}}/config/settings/production.py @@ -36,7 +36,6 @@ CACHES = { # Mimicing memcache behavior. # http://jazzband.github.io/django-redis/latest/#_memcached_exceptions_behavior "IGNORE_EXCEPTIONS": True, - "PARSER_CLASS": "redis.connection.HiredisParser", }, } } diff --git a/{{cookiecutter.project_slug}}/requirements/base.txt b/{{cookiecutter.project_slug}}/requirements/base.txt index 0455e749..7fa0aeca 100644 --- a/{{cookiecutter.project_slug}}/requirements/base.txt +++ b/{{cookiecutter.project_slug}}/requirements/base.txt @@ -9,7 +9,7 @@ argon2-cffi==19.2.0 # https://github.com/hynek/argon2_cffi whitenoise==5.0.1 # https://github.com/evansd/whitenoise {%- endif %} redis==3.4.1 # https://github.com/andymccurdy/redis-py -{%- if cookiecutter.windows == "n" %} +{%- if cookiecutter.use_docker == "y" or cookiecutter.windows == "n" %} hiredis==1.0.1 # https://github.com/redis/hiredis-py {%- endif %} {%- if cookiecutter.use_celery == "y" %} diff --git a/{{cookiecutter.project_slug}}/requirements/production.txt b/{{cookiecutter.project_slug}}/requirements/production.txt index 51389345..4f0e6119 100644 --- a/{{cookiecutter.project_slug}}/requirements/production.txt +++ b/{{cookiecutter.project_slug}}/requirements/production.txt @@ -12,7 +12,7 @@ Collectfast==2.1.0 # https://github.com/antonagestam/collectfast {%- if cookiecutter.use_sentry == "y" %} sentry-sdk==0.14.3 # https://github.com/getsentry/sentry-python {%- endif %} -{%- if cookiecutter.windows == "y" %} +{%- if cookiecutter.use_docker == "y" or cookiecutter.windows == "y" %} hiredis==1.0.1 # https://github.com/redis/hiredis-py {%- endif %} From b70b6ebd7e99e8bba88fddd29653f501c513ea2b Mon Sep 17 00:00:00 2001 From: Andrew-Chen-Wang Date: Fri, 1 May 2020 10:39:30 -0400 Subject: [PATCH 4/4] Fixed production.txt typo when docker and windows combine --- {{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 4f0e6119..c5ba356c 100644 --- a/{{cookiecutter.project_slug}}/requirements/production.txt +++ b/{{cookiecutter.project_slug}}/requirements/production.txt @@ -12,7 +12,7 @@ Collectfast==2.1.0 # https://github.com/antonagestam/collectfast {%- if cookiecutter.use_sentry == "y" %} sentry-sdk==0.14.3 # https://github.com/getsentry/sentry-python {%- endif %} -{%- if cookiecutter.use_docker == "y" or cookiecutter.windows == "y" %} +{%- if cookiecutter.use_docker == "n" and cookiecutter.windows == "y" %} hiredis==1.0.1 # https://github.com/redis/hiredis-py {%- endif %}