From c38289493410d2401a5903f6feada0d3f3d79fe3 Mon Sep 17 00:00:00 2001
From: Bruno Alla
Date: Tue, 2 Mar 2021 22:50:28 +0000
Subject: [PATCH] Fix pre-commit hook issues
---
.../.pre-commit-config.yaml | 1 -
{{cookiecutter.project_slug}}/.pylintrc | 2 +-
{{cookiecutter.project_slug}}/LICENSE | 8 ++--
{{cookiecutter.project_slug}}/Procfile | 4 +-
{{cookiecutter.project_slug}}/README.rst | 41 ++++++++++---------
.../compose/production/traefik/traefik.yml | 2 +-
.../config/settings/base.py | 5 ++-
.../config/settings/production.py | 3 +-
{{cookiecutter.project_slug}}/local.yml | 5 +--
{{cookiecutter.project_slug}}/production.yml | 3 +-
.../utility/install_python_dependencies.sh | 3 +-
.../templates/403.html | 3 +-
.../templates/404.html | 3 +-
.../templates/500.html | 3 +-
.../templates/account/account_inactive.html | 2 +-
.../templates/account/base.html | 2 +-
.../templates/account/email.html | 2 +-
.../templates/account/email_confirm.html | 2 +-
.../templates/account/login.html | 2 +-
.../templates/account/logout.html | 4 +-
.../templates/account/password_change.html | 2 +-
.../templates/account/password_reset.html | 2 +-
.../account/password_reset_done.html | 6 +--
.../account/password_reset_from_key.html | 2 +-
.../account/password_reset_from_key_done.html | 2 +-
.../templates/account/password_set.html | 2 +-
.../templates/account/signup.html | 2 +-
.../templates/account/signup_closed.html | 2 +-
.../templates/account/verification_sent.html | 2 +-
.../account/verified_email_required.html | 4 +-
.../templates/base.html | 24 +++++------
.../templates/pages/about.html | 2 +-
.../templates/pages/home.html | 2 +-
.../templates/users/user_detail.html | 3 +-
.../templates/users/user_form.html | 3 +-
35 files changed, 78 insertions(+), 82 deletions(-)
diff --git a/{{cookiecutter.project_slug}}/.pre-commit-config.yaml b/{{cookiecutter.project_slug}}/.pre-commit-config.yaml
index fd4572f7..df71ea61 100644
--- a/{{cookiecutter.project_slug}}/.pre-commit-config.yaml
+++ b/{{cookiecutter.project_slug}}/.pre-commit-config.yaml
@@ -26,4 +26,3 @@ repos:
- id: flake8
args: ['--config=setup.cfg']
additional_dependencies: [flake8-isort]
-
diff --git a/{{cookiecutter.project_slug}}/.pylintrc b/{{cookiecutter.project_slug}}/.pylintrc
index a0955f07..dff52e75 100644
--- a/{{cookiecutter.project_slug}}/.pylintrc
+++ b/{{cookiecutter.project_slug}}/.pylintrc
@@ -1,5 +1,5 @@
[MASTER]
-load-plugins=pylint_django{% if cookiecutter.use_celery == "y" %}, pylint_celery {% endif %}
+load-plugins=pylint_django{% if cookiecutter.use_celery == "y" %}, pylint_celery{% endif %}
[FORMAT]
max-line-length=120
diff --git a/{{cookiecutter.project_slug}}/LICENSE b/{{cookiecutter.project_slug}}/LICENSE
index c831e030..812fa0fa 100644
--- a/{{cookiecutter.project_slug}}/LICENSE
+++ b/{{cookiecutter.project_slug}}/LICENSE
@@ -7,7 +7,7 @@ Permission is hereby granted, free of charge, to any person obtaining a copy of
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-{% elif cookiecutter.open_source_license == 'BSD' %}
+{%- elif cookiecutter.open_source_license == 'BSD' %}
Copyright (c) {% now 'utc', '%Y' %}, {{ cookiecutter.author_name }}
All rights reserved.
@@ -35,7 +35,7 @@ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
OF THE POSSIBILITY OF SUCH DAMAGE.
-{% elif cookiecutter.open_source_license == 'GPLv3' %}
+{%- elif cookiecutter.open_source_license == 'GPLv3' %}
Copyright (c) {% now 'utc', '%Y' %}, {{ cookiecutter.author_name }}
This program is free software: you can redistribute it and/or modify
@@ -50,7 +50,7 @@ GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see .
-{% elif cookiecutter.open_source_license == 'Apache Software License 2.0' %}
+{%- elif cookiecutter.open_source_license == 'Apache Software License 2.0' %}
Apache License
Version 2.0, January 2004
@@ -242,4 +242,4 @@ along with this program. If not, see .
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-{% endif %}
+{%- endif %}
diff --git a/{{cookiecutter.project_slug}}/Procfile b/{{cookiecutter.project_slug}}/Procfile
index 0becb2cb..8679a066 100644
--- a/{{cookiecutter.project_slug}}/Procfile
+++ b/{{cookiecutter.project_slug}}/Procfile
@@ -1,10 +1,10 @@
release: python manage.py migrate
-{% if cookiecutter.use_async == "y" -%}
+{%- if cookiecutter.use_async == "y" -%}
web: gunicorn config.asgi:application -k uvicorn.workers.UvicornWorker
{%- else %}
web: gunicorn config.wsgi:application
{%- endif %}
-{% if cookiecutter.use_celery == "y" -%}
+{%- if cookiecutter.use_celery == "y" -%}
worker: celery worker --app=config.celery_app --loglevel=info
beat: celery beat --app=config.celery_app --loglevel=info
{%- endif %}
diff --git a/{{cookiecutter.project_slug}}/README.rst b/{{cookiecutter.project_slug}}/README.rst
index 2aae422c..b120f16a 100644
--- a/{{cookiecutter.project_slug}}/README.rst
+++ b/{{cookiecutter.project_slug}}/README.rst
@@ -9,10 +9,10 @@
.. image:: https://img.shields.io/badge/code%20style-black-000000.svg
:target: https://github.com/ambv/black
:alt: Black code style
-{% if cookiecutter.open_source_license != "Not open source" %}
+{%- if cookiecutter.open_source_license != "Not open source" %}
:License: {{cookiecutter.open_source_license}}
-{% endif %}
+{%- endif %}
Settings
--------
@@ -67,7 +67,7 @@ Moved to `Live reloading and SASS compilation`_.
.. _`Live reloading and SASS compilation`: http://cookiecutter-django.readthedocs.io/en/latest/live-reloading-and-sass-compilation.html
-{% if cookiecutter.use_celery == "y" %}
+{%- if cookiecutter.use_celery == "y" %}
Celery
^^^^^^
@@ -83,19 +83,21 @@ To run a celery worker:
Please note: For Celery's import magic to work, it is important *where* the celery commands are run. If you are in the same folder with *manage.py*, you should be right.
-{% endif %}
-{% if cookiecutter.use_mailhog == "y" %}
+{%- endif %}
+{%- if cookiecutter.use_mailhog == "y" %}
Email Server
^^^^^^^^^^^^
-{% if cookiecutter.use_docker == 'y' %}
+{%- if cookiecutter.use_docker == 'y' %}
+
In development, it is often nice to be able to see emails that are being sent from your application. For that reason local SMTP server `MailHog`_ with a web interface is available as docker container.
Container mailhog will start automatically when you will run all docker containers.
Please check `cookiecutter-django Docker documentation`_ for more details how to start all containers.
With MailHog running, to view messages that are sent by your application, open your browser and go to ``http://127.0.0.1:8025``
-{% else %}
+{%- else %}
+
In development, it is often nice to be able to see emails that are being sent from your application. If you choose to use `MailHog`_ when generating the project a local SMTP server with a web interface will be available.
#. `Download the latest MailHog release`_ for your OS.
@@ -117,10 +119,10 @@ In development, it is often nice to be able to see emails that are being sent fr
Now you have your own mail server running locally, ready to receive whatever you send it.
.. _`Download the latest MailHog release`: https://github.com/mailhog/MailHog/releases
-{% endif %}
+{%- endif %}
.. _mailhog: https://github.com/mailhog/MailHog
-{% endif %}
-{% if cookiecutter.use_sentry == "y" %}
+{%- endif %}
+{%- if cookiecutter.use_sentry == "y" %}
Sentry
^^^^^^
@@ -129,13 +131,13 @@ Sentry is an error logging aggregator service. You can sign up for a free accoun
The system is setup with reasonable defaults, including 404 logging and integration with the WSGI application.
You must set the DSN url in production.
-{% endif %}
+{%- endif %}
Deployment
----------
The following details how to deploy this application.
-{% if cookiecutter.use_heroku.lower() == "y" %}
+{%- if cookiecutter.use_heroku.lower() == "y" %}
Heroku
^^^^^^
@@ -143,8 +145,8 @@ Heroku
See detailed `cookiecutter-django Heroku documentation`_.
.. _`cookiecutter-django Heroku documentation`: http://cookiecutter-django.readthedocs.io/en/latest/deployment-on-heroku.html
-{% endif %}
-{% if cookiecutter.use_docker.lower() == "y" %}
+{%- endif %}
+{%- if cookiecutter.use_docker.lower() == "y" %}
Docker
^^^^^^
@@ -152,9 +154,8 @@ Docker
See detailed `cookiecutter-django Docker documentation`_.
.. _`cookiecutter-django Docker documentation`: http://cookiecutter-django.readthedocs.io/en/latest/deployment-with-docker.html
-{% endif %}
-
-{% if cookiecutter.custom_bootstrap_compilation == "y" %}
+{%- endif %}
+{%- if cookiecutter.custom_bootstrap_compilation == "y" %}
Custom Bootstrap Compilation
^^^^^^
@@ -163,11 +164,11 @@ Bootstrap v4 is installed using npm and customised by tweaking your variables in
You can find a list of available variables `in the bootstrap source`_, or get explanations on them in the `Bootstrap docs`_.
-{% if cookiecutter.js_task_runner == 'Gulp' %}
+{%- if cookiecutter.js_task_runner == 'Gulp' %}
Bootstrap's javascript as well as its dependencies is concatenated into a single file: ``static/js/vendors.js``.
-{% endif %}
+{%- endif %}
.. _in the bootstrap source: https://github.com/twbs/bootstrap/blob/v4-dev/scss/_variables.scss
.. _Bootstrap docs: https://getbootstrap.com/docs/4.1/getting-started/theming/
-{% endif %}
+{%- endif %}
diff --git a/{{cookiecutter.project_slug}}/compose/production/traefik/traefik.yml b/{{cookiecutter.project_slug}}/compose/production/traefik/traefik.yml
index 7b56063f..cc183cd6 100644
--- a/{{cookiecutter.project_slug}}/compose/production/traefik/traefik.yml
+++ b/{{cookiecutter.project_slug}}/compose/production/traefik/traefik.yml
@@ -35,7 +35,7 @@ http:
web-secure-router:
{%- if cookiecutter.domain_name.count('.') == 1 %}
rule: "Host(`{{ cookiecutter.domain_name }}`) || Host(`www.{{ cookiecutter.domain_name }}`)"
- {% else %}
+ {%- else %}
rule: "Host(`{{ cookiecutter.domain_name }}`)"
{%- endif %}
entryPoints:
diff --git a/{{cookiecutter.project_slug}}/config/settings/base.py b/{{cookiecutter.project_slug}}/config/settings/base.py
index f69908c2..640d8b62 100644
--- a/{{cookiecutter.project_slug}}/config/settings/base.py
+++ b/{{cookiecutter.project_slug}}/config/settings/base.py
@@ -44,7 +44,7 @@ LOCALE_PATHS = [str(ROOT_DIR / "locale")]
DATABASES = {"default": env.db("DATABASE_URL")}
{%- else %}
DATABASES = {
- "default": env.db("DATABASE_URL", default="postgres://{% if cookiecutter.windows == 'y' %}localhost{% endif %}/{{cookiecutter.project_slug}}")
+ "default": env.db("DATABASE_URL", default="postgres://{% if cookiecutter.windows == 'y' %}localhost{% endif %}/{{cookiecutter.project_slug}}"),
}
{%- endif %}
DATABASES["default"]["ATOMIC_REQUESTS"] = True
@@ -230,7 +230,8 @@ X_FRAME_OPTIONS = "DENY"
# ------------------------------------------------------------------------------
# https://docs.djangoproject.com/en/dev/ref/settings/#email-backend
EMAIL_BACKEND = env(
- "DJANGO_EMAIL_BACKEND", default="django.core.mail.backends.smtp.EmailBackend"
+ "DJANGO_EMAIL_BACKEND",
+ default="django.core.mail.backends.smtp.EmailBackend",
)
# https://docs.djangoproject.com/en/dev/ref/settings/#email-timeout
EMAIL_TIMEOUT = 5
diff --git a/{{cookiecutter.project_slug}}/config/settings/production.py b/{{cookiecutter.project_slug}}/config/settings/production.py
index bd0acfbd..59928f82 100644
--- a/{{cookiecutter.project_slug}}/config/settings/production.py
+++ b/{{cookiecutter.project_slug}}/config/settings/production.py
@@ -146,7 +146,8 @@ DEFAULT_FROM_EMAIL = env(
SERVER_EMAIL = env("DJANGO_SERVER_EMAIL", default=DEFAULT_FROM_EMAIL)
# https://docs.djangoproject.com/en/dev/ref/settings/#email-subject-prefix
EMAIL_SUBJECT_PREFIX = env(
- "DJANGO_EMAIL_SUBJECT_PREFIX", default="[{{cookiecutter.project_name}}]"
+ "DJANGO_EMAIL_SUBJECT_PREFIX",
+ default="[{{cookiecutter.project_name}}]",
)
# ADMIN
diff --git a/{{cookiecutter.project_slug}}/local.yml b/{{cookiecutter.project_slug}}/local.yml
index e285f349..6241ceed 100644
--- a/{{cookiecutter.project_slug}}/local.yml
+++ b/{{cookiecutter.project_slug}}/local.yml
@@ -52,7 +52,6 @@ services:
ports:
- "7000:7000"
command: /start-docs
-
{%- if cookiecutter.use_mailhog == 'y' %}
mailhog:
@@ -75,7 +74,7 @@ services:
depends_on:
- redis
- postgres
- {% if cookiecutter.use_mailhog == 'y' -%}
+ {%- if cookiecutter.use_mailhog == 'y' %}
- mailhog
{%- endif %}
ports: []
@@ -88,7 +87,7 @@ services:
depends_on:
- redis
- postgres
- {% if cookiecutter.use_mailhog == 'y' -%}
+ {%- if cookiecutter.use_mailhog == 'y' %}
- mailhog
{%- endif %}
ports: []
diff --git a/{{cookiecutter.project_slug}}/production.yml b/{{cookiecutter.project_slug}}/production.yml
index 93b61b13..3cccdb65 100644
--- a/{{cookiecutter.project_slug}}/production.yml
+++ b/{{cookiecutter.project_slug}}/production.yml
@@ -64,10 +64,9 @@ services:
<<: *django
image: {{ cookiecutter.project_slug }}_production_flower
command: /start-flower
-
{%- endif %}
+ {%- if cookiecutter.cloud_provider == 'AWS' %}
- {% if cookiecutter.cloud_provider == 'AWS' %}
awscli:
build:
context: .
diff --git a/{{cookiecutter.project_slug}}/utility/install_python_dependencies.sh b/{{cookiecutter.project_slug}}/utility/install_python_dependencies.sh
index 51793484..e09ebf6f 100755
--- a/{{cookiecutter.project_slug}}/utility/install_python_dependencies.sh
+++ b/{{cookiecutter.project_slug}}/utility/install_python_dependencies.sh
@@ -33,9 +33,8 @@ if [ -z "$VIRTUAL_ENV" ]; then
echo >&2 -e "\n"
exit 1;
else
-
pip install -r $PROJECT_DIR/requirements/local.txt
- {% if cookiecutter.use_heroku == "y" -%}
+ {%- if cookiecutter.use_heroku == "y" -%}
pip install -r $PROJECT_DIR/requirements.txt
{%- endif %}
fi
diff --git a/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/templates/403.html b/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/templates/403.html
index 31da9882..4c4745f7 100644
--- a/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/templates/403.html
+++ b/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/templates/403.html
@@ -6,4 +6,5 @@
Forbidden (403)
{% if exception %}{{ exception }}{% else %}You're not allowed to access this page.{% endif %}
{% blocktrans %}We have sent an e-mail to you for verification. Follow the link provided to finalize the signup process. Please contact us if you do not receive it within a few minutes.{% endblocktrans %}
{% endblock %}
-{% endraw %}
+{%- endraw %}
diff --git a/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/templates/account/verified_email_required.html b/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/templates/account/verified_email_required.html
index f3078b68..8eafcbed 100644
--- a/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/templates/account/verified_email_required.html
+++ b/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/templates/account/verified_email_required.html
@@ -18,7 +18,5 @@ verification. Please click on the link inside this e-mail. Please
contact us if you do not receive it within a few minutes.{% endblocktrans %}