Skip to content

Commit

Permalink
feat: Upgrade to Django 5.0 and fix docker image
Browse files Browse the repository at this point in the history
  • Loading branch information
sopelj committed Nov 2, 2024
1 parent 5571182 commit 3445f70
Show file tree
Hide file tree
Showing 6 changed files with 146 additions and 135 deletions.
8 changes: 4 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ repos:
hooks:
- id: black
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.6.9
rev: v0.7.2
hooks:
- id: ruff
args: [--fix, --exit-non-zero-on-fix]
Expand All @@ -47,7 +47,7 @@ repos:
- id: markdownlint-fix
args: [--disable, MD013]
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.11.2
rev: v1.13.0
hooks:
- id: mypy
exclude: "migrations"
Expand All @@ -67,9 +67,9 @@ repos:
- "pint"
- "psycopg2-binary"
- "recipe-scrapers>=15.0.0"
- "django-stubs-ext"
- "django-stubs"
- "git+https://github.com/typeddjango/djangorestframework-stubs@master"
- "django-stubs-ext[compatible-mypy]"
- "djangorestframework-stubs[compatible-mypy]"
- "pytest"
- "types-requests"
- "types-pyyaml"
Expand Down
2 changes: 1 addition & 1 deletion docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
FROM python:3.12-alpine AS build-image

RUN apk add postgresql-dev build-base python3-dev jpeg-dev zlib-dev openldap-dev
RUN apk add postgresql-dev build-base git python3-dev jpeg-dev zlib-dev openldap-dev
RUN python -m venv /opt/venv

WORKDIR /opt/
Expand Down
4 changes: 2 additions & 2 deletions docker/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
#!/usr/bin/env bash

echo "Waiting for postgres..."
while ! nc -z "${POSTGRES_DB_HOST} "5432; do
while ! nc -z "${POSTGRES_DB_HOST}" 5432; do
sleep 0.1
done
echo "PostgreSQL started"
echo "Postgres started"

export DATABASE_URL="postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@${POSTGRES_DB_HOST}/${POSTGRES_DB}"

Expand Down
2 changes: 2 additions & 0 deletions example.env
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ POSTGRES_DB=postgres
POSTGRES_USER=postgres
POSTGRES_PASSWORD=insecure-change-this
POSTGRES_DB_HOST=localhost
# Example - Not needed for Docker
# DATABASE_URL=postgresql://postgres:insecure-change-this@recipe-repo/recipe-repo

# CACHE
MEMCACHED_ENABLED=false
Expand Down
9 changes: 6 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ classifiers=[
"Programming Language :: Python :: 3.12",
]
dependencies = [
"django>=4.2",
"django>=5.0",
"django-admin-interface",
"django-admin-sortable2",
"django-colorfield",
"django-breeze",
"django-breeze@git+https://github.com/Louxsdon/django-breeze@master",
"django-environ",
"django-extensions",
"django-cachalot",
Expand All @@ -33,7 +33,7 @@ dependencies = [
"pint",
"recipe-scrapers>=15.0.0",
"werkzeug",
"django-stubs-ext",
"django-stubs-ext[compatible-mypy]>=5.1.0",
"psycopg[c]>=3.1.8",
]

Expand All @@ -58,6 +58,9 @@ production = [

[tool.hatch]

[tool.hatch.metadata]
allow-direct-references = true

[tool.hatch.envs.default]
python = "3.12"
type = "virtual"
Expand Down
Loading

0 comments on commit 3445f70

Please sign in to comment.