Skip to content

Commit 0cccc8a

Browse files
committed
Initial Django v5.2 migration spike
There are questions that want to be answered, but this should allow: 1. Standing up the stack on `master` 2. Taking it down 3. Doing a `make build-local` from this branch 4. Standing up the stack on this branch 5. Successfully launching Therer was an error with the testclient; when we returned from auth, the `api_ver` seems not to be set. This implies any number of things, but the important first step was getting the app to stand up with a completely new set of modules. Note that we use the `vendor` directory, under version control. This may not be strictly necessary in a containerized build world. This commit (currently) does not modify the tree when loading requirements.in and friends. To be discussed/revisited.
1 parent 80e796a commit 0cccc8a

File tree

20 files changed

+1912
-1353
lines changed

20 files changed

+1912
-1353
lines changed

Makefile

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,16 @@
11
reqs-compile:
2+
rm -f requirements/requirements.txt
3+
rm -f requirements/requirements.dev.txt
24
pip-compile --generate-hashes --output-file requirements/requirements.txt requirements/requirements.in
35
pip-compile --generate-hashes --output-file requirements/requirements.dev.txt requirements/requirements.dev.in
46

57
# Note: requirements.dev.txt includes packages from requirements.txt also.
68
reqs-download:
7-
pip download -r requirements/requirements.dev.txt --dest vendor --platform manylinux2014_x86_64 --abi cp311 --no-deps
9+
pip download -r requirements/requirements.dev.txt --dest vendor --platform manylinux2014_x86_64 --no-deps
810

911
#Note: Only installs prod requirements NOT RECOMMENDED FOR DEVELOPMENT.
1012
reqs-download-prod:
11-
pip download -r requirements/requirements.txt --dest vendor --platform manylinux2014_x86_64 --abi cp311 --no-deps
13+
pip download -r requirements/requirements.txt --dest vendor --platform manylinux2014_x86_64 --no-deps
1214

1315
reqs-install:
1416
pip install -r requirements/requirements.txt --no-index --find-links ./vendor/

apps/accounts/templates/account-settings.html

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
{% extends "oauth2_provider/base.html" %}
22
{% load i18n %}
3-
{% load bootstrap5 %}
43

54
{% block bannerBackButton %}
65
<a class="banner-back-button" href="/" style="outline-color: transparent; background-color: transparent"><i data-feather="arrow-left"></i>Back to Dashboard</a>

apps/accounts/templates/registration/login.html

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
{% extends "base.html" %}
22
{% load i18n %}
3-
{% load bootstrap5 %}
43

54
<!-- Ignore Banner Code -->
65
{% block banner %}{% endblock %}

apps/accounts/templates/registration/signup.html

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
{% extends "base.html" %}
22
{% load i18n %}
3-
{% load bootstrap5 %}
43

54
{% block Content %}
65

apps/dot_ext/templates/oauth2_provider/authorize.html

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33

44

55
{% load i18n %}
6-
{% load bootstrap5 %}
76

87
<!-- Ignore Banner Code -->
98
{% block banner %}{% endblock %}

dev-local/Dockerfile.buildenv

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
FROM python:3.14-trixie
2+
3+
WORKDIR /code
4+
RUN pip install pip-tools ; pip install --upgrade pip
5+
6+
COPY .. /code
7+
8+
CMD [ "/bin/bash" ]

dev-local/Dockerfile.local

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM python:3.11-trixie
1+
FROM python:3.14-trixie
22

33
ENV PYTHONUNBUFFERED=1
44
ENV PYDEVD_DISABLE_FILE_VALIDATION=1
@@ -29,7 +29,21 @@ RUN pip install --upgrade \
2929
pip \
3030
pip-tools \
3131
setuptools
32-
RUN pip install -r requirements/requirements.dev.txt \
33-
--no-index \
34-
--find-links \
35-
./vendor/
32+
33+
# Something odd with the permissions.
34+
# Also, this makes sure we don't write the output of this process
35+
# into the tree while developing and testing locally.
36+
# We should use a dedicated build container for that.
37+
USER root
38+
RUN mkdir /build-requirements ; chown DEV:DEV /build-requirements
39+
USER DEV
40+
RUN cp -R requirements /build-requirements
41+
WORKDIR /build-requirements
42+
RUN rm -f requirements/requirements.txt && rm -f requirements/requirements.dev.txt
43+
RUN pip-compile --strip-extras --generate-hashes --output-file requirements/requirements.txt requirements/requirements.in \
44+
&& pip-compile --strip-extras --generate-hashes --output-file requirements/requirements.dev.txt requirements/requirements.dev.in
45+
RUN pip download -r requirements/requirements.dev.txt --dest vendor --platform manylinux2014_x86_64 --no-deps
46+
# Removed --no-index because of https://github.com/pypa/pip/issues/12050
47+
RUN pip install -r requirements/requirements.dev.txt --find-links ./vendor/
48+
# Make sure we end back up in the root of the codebase!
49+
WORKDIR /code

dev-local/Makefile

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,16 @@
11
all: build-local run-local
22

3+
buildenv:
4+
cd ../dev-local ; docker build \
5+
--platform "linux/amd64" \
6+
-t buildenv:latest \
7+
-f Dockerfile.buildenv ..
8+
9+
run-buildenv:
10+
cd ../dev-local ; docker run --platform linux/amd64 -v ${PWD}/..:/code -it buildenv:latest
11+
12+
# --progress=plain
13+
# if you want to see the build process in a less-fancy way.
314
build-local:
415
@echo "building mock sls image"
516
cd ../msls-local ; make all ; cd ../dev-local

dev-local/start-local.sh

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,21 @@ set -a
77
if [ "${DB_MIGRATIONS}" = "true" ]
88
then
99
echo "🔵 running migrations"
10-
python manage.py migrate
1110

12-
# We will recrate this with every launch.
13-
# echo "TRUNCATE authorization_archiveddataaccessgrant;" | psql "${DATABASES_CUSTOM}"
11+
# FIXME: Why is this necessary? What is going on that these do not seem to exist when I
12+
# stand up a stack from `master`, but when I do a version update, these columns are
13+
# now necessary/present for our migrations to run. It speaks to something odd.
14+
columns=("post_logout_redirect_uris" "hash_client_secret" "allowed_origins")
15+
for col in ${columns[@]}; do
16+
echo "💽 Adding column ${col} to dot_ext_application"
17+
psql "${DATABASES_CUSTOM}" \
18+
-c "ALTER TABLE \"dot_ext_application\" ADD COLUMN IF NOT EXISTS \"${col}\" text NULL;"
19+
done
1420

21+
python manage.py showmigrations
22+
23+
python manage.py migrate
24+
1525
# Only create the root user if it doesn't exist.
1626
result=$(echo "from django.contrib.auth.models import User; print(1) if User.objects.filter(username='${SUPER_USER_NAME}').exists() else print(0)" | python manage.py shell)
1727
if [[ "$result" == "0" ]]; then

hhs_oauth_server/settings/base.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,6 @@
211211
"apps.bb2_tools",
212212
# 3rd Party ---------------------
213213
"corsheaders",
214-
"bootstrap5",
215214
"waffle",
216215
# DOT must be installed after apps.dot_ext in order to override templates
217216
"oauth2_provider",
@@ -246,7 +245,8 @@
246245
AXES_FAILURE_LIMIT = 5
247246
AXES_LOGIN_FAILURE_LIMIT = 5
248247
AXES_LOCK_OUT_AT_FAILURE = True
249-
AXES_ONLY_USER_FAILURES = True
248+
# 20251126 Deprecated.
249+
# AXES_ONLY_USER_FAILURES = True
250250
AXES_USERNAME_FORM_FIELD = "username"
251251

252252
# Used for testing for optional apps in templates without causing a crash

0 commit comments

Comments
 (0)