Fix pre-commit hook issues

This commit is contained in:
Bruno Alla 2021-03-02 22:50:28 +00:00
parent 095a2a56af
commit c382894934
35 changed files with 78 additions and 82 deletions

View File

@ -26,4 +26,3 @@ repos:
- id: flake8
args: ['--config=setup.cfg']
additional_dependencies: [flake8-isort]

View File

@ -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

View File

@ -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 <http://www.gnu.org/licenses/>.
{% 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 <http://www.gnu.org/licenses/>.
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 %}

View File

@ -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 %}

View File

@ -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 %}

View File

@ -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:

View File

@ -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

View File

@ -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

View File

@ -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: []

View File

@ -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: .

View File

@ -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

View File

@ -6,4 +6,5 @@
<h1>Forbidden (403)</h1>
<p>{% if exception %}{{ exception }}{% else %}You're not allowed to access this page.{% endif %}</p>
{% endblock content %}{% endraw %}
{% endblock content %}
{%- endraw %}

View File

@ -6,4 +6,5 @@
<h1>Page not found</h1>
<p>{% if exception %}{{ exception }}{% else %}This is not the page you were looking for.{% endif %}</p>
{% endblock content %}{% endraw %}
{% endblock content %}
{%- endraw %}

View File

@ -9,5 +9,4 @@
<p>We track these errors automatically, but if the problem persists feel free to contact us. In the meantime, try refreshing.</p>
{% endblock content %}
{% endraw %}
{%- endraw %}

View File

@ -9,4 +9,4 @@
<p>{% trans "This account is inactive." %}</p>
{% endblock %}
{% endraw %}
{%- endraw %}

View File

@ -8,4 +8,4 @@
</div>
</div>
{% endblock %}
{% endraw %}
{%- endraw %}

View File

@ -77,4 +77,4 @@ window.addEventListener('DOMContentLoaded',function() {
$('.form-group').removeClass('row');
</script>
{% endblock %}
{% endraw %}
{%- endraw %}

View File

@ -29,4 +29,4 @@
{% endif %}
{% endblock %}
{% endraw %}
{%- endraw %}

View File

@ -45,4 +45,4 @@ for a {{ site_name }} account and sign in below:{% endblocktrans %}</p>
</form>
{% endblock %}
{% endraw %}
{%- endraw %}

View File

@ -16,7 +16,5 @@
{% endif %}
<button class="btn btn-danger" type="submit">{% trans 'Sign Out' %}</button>
</form>
{% endblock %}
{% endraw %}
{%- endraw %}

View File

@ -14,4 +14,4 @@
<button class="btn btn-primary" type="submit" name="action">{% trans "Change Password" %}</button>
</form>
{% endblock %}
{% endraw %}
{%- endraw %}

View File

@ -23,4 +23,4 @@
<p>{% blocktrans %}Please contact us if you have any trouble resetting your password.{% endblocktrans %}</p>
{% endblock %}
{% endraw %}
{%- endraw %}

View File

@ -7,11 +7,11 @@
{% block inner %}
<h1>{% trans "Password Reset" %}</h1>
{% if user.is_authenticated %}
{% include "account/snippets/already_logged_in.html" %}
{% endif %}
<p>{% blocktrans %}We have sent you an e-mail. Please contact us if you do not receive it within a few minutes.{% endblocktrans %}</p>
{% endblock %}
{% endraw %}
{%- endraw %}

View File

@ -22,4 +22,4 @@
{% endif %}
{% endif %}
{% endblock %}
{% endraw %}
{%- endraw %}

View File

@ -7,4 +7,4 @@
<h1>{% trans "Change Password" %}</h1>
<p>{% trans 'Your password is now changed.' %}</p>
{% endblock %}
{% endraw %}
{%- endraw %}

View File

@ -14,4 +14,4 @@
<input class="btn btn-primary" type="submit" name="action" value="{% trans 'Set Password' %}"/>
</form>
{% endblock %}
{% endraw %}
{%- endraw %}

View File

@ -20,4 +20,4 @@
</form>
{% endblock %}
{% endraw %}
{%- endraw %}

View File

@ -9,4 +9,4 @@
<p>{% trans "We are sorry, but the sign up is currently closed." %}</p>
{% endblock %}
{% endraw %}
{%- endraw %}

View File

@ -10,4 +10,4 @@
<p>{% 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 %}</p>
{% endblock %}
{% endraw %}
{%- endraw %}

View File

@ -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 %}</p>
<p>{% blocktrans %}<strong>Note:</strong> you can still <a href="{{ email_url }}">change your e-mail address</a>.{% endblocktrans %}</p>
{% endblock %}
{% endraw %}
{%- endraw %}

View File

@ -16,26 +16,26 @@
<link rel="icon" href="{% static 'images/favicons/favicon.ico' %}">
{% block css %}
{% endraw %}{% if cookiecutter.custom_bootstrap_compilation == "n" %}{% raw %}
{%- endraw %}{% if cookiecutter.custom_bootstrap_compilation == "n" %}{% raw %}
<!-- Latest compiled and minified Bootstrap CSS -->
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
{% endraw %}{% endif %}{% raw %}
{%- endraw %}{% endif %}{% raw %}
<!-- Your stuff: Third-party CSS libraries go here -->
{% endraw %}{% if cookiecutter.use_compressor == "y" %}{% raw %}{% compress css %}{% endraw %}{% endif %}{% raw %}
{%- endraw %}{% if cookiecutter.use_compressor == "y" %}{% raw %}{% compress css %}{% endraw %}{% endif %}{% raw %}
<!-- This file stores project-specific CSS -->
{% endraw %}{% if cookiecutter.js_task_runner == "Gulp" and cookiecutter.use_compressor == "n" %}{% raw %}
{%- endraw %}{% if cookiecutter.js_task_runner == "Gulp" and cookiecutter.use_compressor == "n" %}{% raw %}
<link href="{% static 'css/project.min.css' %}" rel="stylesheet">
{% endraw %}{% else %}{% raw %}
{%- endraw %}{% else %}{% raw %}
<link href="{% static 'css/project.css' %}" rel="stylesheet">
{% endraw %}{% endif %}{% raw %}
{% endraw %}{% if cookiecutter.use_compressor == "y" %}{% raw %}{% endcompress %}{% endraw %}{% endif %}{% raw %}
{%- endraw %}{% endif %}{% raw %}
{%- endraw %}{% if cookiecutter.use_compressor == "y" %}{% raw %}{% endcompress %}{% endraw %}{% endif %}{% raw %}
{% endblock %}
<!-- Le javascript
================================================== -->
{# Placed at the top of the document so pages load faster with defer #}
{% block javascript %}
{% endraw %}{% if cookiecutter.custom_bootstrap_compilation == "y" and cookiecutter.js_task_runner == "Gulp" %}{% raw %}
{%- endraw %}{% if cookiecutter.custom_bootstrap_compilation == "y" and cookiecutter.js_task_runner == "Gulp" %}{% raw %}
<!-- Vendor dependencies bundled as one file-->
{% endraw %}{% if cookiecutter.use_compressor == "y" %}{% raw %}{% compress js %}{% endraw %}{% endif %}{% raw %}
<script defer src="{% static 'js/vendors.js' %}"></script>
@ -47,12 +47,12 @@
<script defer src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous"></script>
<!-- Your stuff: Third-party javascript libraries go here -->
{% endraw %}{% endif %}{% raw %}
{%- endraw %}{% endif %}{% raw %}
<!-- place project specific Javascript in this file -->
{% endraw %}{% if cookiecutter.use_compressor == "y" %}{% raw %}{% compress js %}{% endraw %}{% endif %}{% raw %}
{%- endraw %}{% if cookiecutter.use_compressor == "y" %}{% raw %}{% compress js %}{% endraw %}{% endif %}{% raw %}
<script defer src="{% static 'js/project.js' %}"></script>
{% endraw %}{% if cookiecutter.use_compressor == "y" %}{% raw %}{% endcompress %}{% endraw %}{% endif %}{% raw %}
{%- endraw %}{% if cookiecutter.use_compressor == "y" %}{% raw %}{% endcompress %}{% endraw %}{% endif %}{% raw %}
{% endblock javascript %}
@ -121,4 +121,4 @@
{% endblock inline_javascript %}
</body>
</html>
{% endraw %}
{%- endraw %}

View File

@ -1 +1 @@
{% raw %}{% extends "base.html" %}{% endraw %}
{% raw %}{% extends "base.html" %}{% endraw %}

View File

@ -1 +1 @@
{% raw %}{% extends "base.html" %}{% endraw %}
{% raw %}{% extends "base.html" %}{% endraw %}

View File

@ -30,7 +30,6 @@
<!-- End Action buttons -->
{% endif %}
</div>
{% endblock content %}
{% endraw %}
{%- endraw %}

View File

@ -14,4 +14,5 @@
</div>
</div>
</form>
{% endblock %}{% endraw %}
{% endblock %}
{%- endraw %}