Skip to content

Commit

Permalink
Upgrade Django to 5.1 and Python to 3.12
Browse files Browse the repository at this point in the history
  • Loading branch information
vitorbaptista committed Nov 20, 2024
1 parent cc4fa8f commit 70f9069
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 31 deletions.
6 changes: 3 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Build stage
FROM python:3.9 AS builder
FROM python:3.12 AS builder

# Set environment variables
ENV PYTHONDONTWRITEBYTECODE 1
Expand Down Expand Up @@ -41,7 +41,7 @@ RUN python manage.py collectstatic --noinput
RUN python manage.py compilemessages

# Run stage
FROM python:3.9-slim
FROM python:3.12-slim

# Set environment variables
ENV PYTHONDONTWRITEBYTECODE 1
Expand All @@ -52,7 +52,7 @@ ENV PORT 8000
WORKDIR /app

# Copy the installed dependencies and project files from the builder stage
COPY --from=builder /usr/local/lib/python3.9/site-packages /usr/local/lib/python3.9/site-packages
COPY --from=builder /usr/local/lib/python3.12/site-packages /usr/local/lib/python3.12/site-packages
COPY --from=builder /usr/local/bin /usr/local/bin
COPY --from=builder /app /app

Expand Down
32 changes: 8 additions & 24 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ readme = "README.md"
package-mode = false

[tool.poetry.dependencies]
python = ">=3.9,<3.10"
django = "^4.2.16"
python = ">=3.10,<3.13"
django = "^5.1.3"
django-widget-tweaks = "^1.5.0"
django-environ = "0.11.2"
django-storages = {extras = ["s3"], version = "^1.14.4"}
Expand Down
4 changes: 2 additions & 2 deletions web/foi_requests/tests/test_admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def test_queryset(self, value, filters):

def _create_list_filter(self, params_value=None):
params = {
ModerationStatusListFilter.parameter_name: params_value,
ModerationStatusListFilter.parameter_name: [params_value],
}
return ModerationStatusListFilter(
None, # request
Expand Down Expand Up @@ -71,7 +71,7 @@ def test_queryset_doesnt_filter_if_value_is_none(self):

def _create_list_filter(self, params_value=None):
params = {
ModerationSenderTypeFilter.parameter_name: params_value,
ModerationSenderTypeFilter.parameter_name: [params_value],
}
return ModerationSenderTypeFilter(
None, # request
Expand Down
10 changes: 10 additions & 0 deletions web/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

import os
import environ
import warnings
from django.utils.translation import gettext_lazy as _
from pathlib import Path

Expand Down Expand Up @@ -234,3 +235,12 @@
},
},
}

## Warnings

# This is deprecated and will be removed in Django 6. By then, we just need to
# remove this.
warnings.filterwarnings(
"ignore", "The FORMS_URLFIELD_ASSUME_HTTPS transitional setting is deprecated."
)
FORMS_URLFIELD_ASSUME_HTTPS = True

0 comments on commit 70f9069

Please sign in to comment.