From 2eda6391db42fc42aa233cea630c2942b2d60bd5 Mon Sep 17 00:00:00 2001 From: Alexander Chaika Date: Mon, 1 Apr 2024 10:33:40 +0300 Subject: [PATCH] Upgrade project --- .github/workflows/checks.yml | 6 +++++- .pre-commit-config.yaml | 6 +++--- Dockerfile | 2 +- Makefile | 10 +++++++--- pyproject.toml | 2 +- requirements.txt | 15 +++++++-------- semkov/apps/search/views.py | 2 +- semkov/settings/base.py | 15 ++++++--------- 8 files changed, 31 insertions(+), 27 deletions(-) diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml index 8ebb0f6..a60fe8e 100644 --- a/.github/workflows/checks.yml +++ b/.github/workflows/checks.yml @@ -31,7 +31,7 @@ jobs: - name: Set up Python uses: actions/setup-python@v4 with: - python-version: "3.11" + python-version: "3.12" - name: Cache pip uses: actions/cache@v3 @@ -62,3 +62,7 @@ jobs: - name: Run Pytest suite run: | pytest --create-db --disable-warnings --ds=semkov.settings.test semkov/ + + - name: Build docker image + run: | + docker build -t mantiby/semkov:latest . diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 25819a3..88bd683 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -15,10 +15,10 @@ repos: - id: trailing-whitespace - repo: https://github.com/asottile/pyupgrade - rev: v3.15.0 + rev: v3.15.2 hooks: - id: pyupgrade - args: [--py311-plus] + args: [--py312-plus] - repo: local hooks: @@ -43,5 +43,5 @@ repos: - id: curlylint types: [ file ] files: \.(html|sls)$ - language_version: python3.11 + language_version: python3.12 additional_dependencies: ['click<8.1'] diff --git a/Dockerfile b/Dockerfile index e9770ef..4be2c75 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM python:3.11-slim +FROM python:3.12-slim # Add directories RUN mkdir -p /srv/semkov/src/ && \ diff --git a/Makefile b/Makefile index adcf8d0..dad440e 100644 --- a/Makefile +++ b/Makefile @@ -20,13 +20,17 @@ restore: docker cp database.sql semkov-postgres:/tmp/database.sql docker exec -it semkov-postgres psql -U semkov semkov -f /tmp/database.sql -update-requirements: - pcu requirements.txt -u - update-data: ./manage.py update_transport ./manage.py update_positions +update-requirements: + pcu requirements.txt -u + pre-commit autoupdate + +pip: + pip install -r requirements.txt + test: pytest --create-db --disable-warnings --ds=semkov.settings.test semkov/ diff --git a/pyproject.toml b/pyproject.toml index bd07b65..c1fb37a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -9,7 +9,7 @@ norecursedirs = ''' [tool.black] line-length = 120 -target_version = ['py311'] +target_version = ['py312'] include = '\.pyi?$' exclude = ''' /( diff --git a/requirements.txt b/requirements.txt index b3dddea..8195130 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,17 +1,16 @@ -wagtail==5.2.2 +wagtail==6.0.1 pillow==10.2.0 -twilio==8.13.0 gunicorn==21.2.0 psycopg2_binary==2.9.9 requests==2.31.0 -pytest>=8.0.0 +pytest>=8.1.1 pytest-django>=4.8.0 -pre_commit>=3.6.1 +pre_commit>=3.7.0 isort>=5.13.2 -pyupgrade>=3.15.0 -black>=24.1.1 +pyupgrade>=3.15.2 +black>=24.3.0 prospector>=1.10.3 -bandit>=1.7.7 -pip-check-updates>=0.23.1 +bandit>=1.7.8 +pip-check-updates>=0.26.1 diff --git a/semkov/apps/search/views.py b/semkov/apps/search/views.py index 1584d80..b817ca5 100644 --- a/semkov/apps/search/views.py +++ b/semkov/apps/search/views.py @@ -2,7 +2,7 @@ from django.shortcuts import render from wagtail.models import Page -from wagtail.search.models import Query +from wagtail.contrib.search_promotions.models import Query def search(request): diff --git a/semkov/settings/base.py b/semkov/settings/base.py index 510b301..7cce53b 100644 --- a/semkov/settings/base.py +++ b/semkov/settings/base.py @@ -111,6 +111,12 @@ } } + +# Models settings + +DEFAULT_AUTO_FIELD = "django.db.models.AutoField" + + # Cache backend # https://docs.djangoproject.com/en/2.1/topics/cache/ @@ -196,15 +202,6 @@ DEFAULT_FROM_EMAIL = "no-reply@manti.by" DEFAULT_TO_EMAIL = "manti.by@gmail.com" -# Twilio account - -TWILIO_FROM_NUMBER = None -TWILIO_ACCOUNT_SID = None -TWILIO_AUTH_TOKEN = None - - -DEFAULT_AUTO_FIELD = "django.db.models.AutoField" - # Scrappers POSITION_PAGE_SLUG = os.environ.get("POSITION_PAGE_SLUG", "ispolkom")