Skip to content

Commit ad431a5

Browse files
committed
Upgrade to Django 5.2 LTS
1 parent 3f90d24 commit ad431a5

4 files changed

Lines changed: 11 additions & 10 deletions

File tree

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ automatically built inside a configurable container. If the build passes
66
validation, the course and its exercises are configured on A+ and compatible
77
grading services.
88

9-
The application is implemented on Django 3.2 (`gitmanager/settings.py`) and
10-
requires Python 3.7+.
9+
The application is implemented on Django 5.2 (`gitmanager/settings.py`) and
10+
requires Python 3.10+.
1111

1212
Gitmanager can be run stand alone without the full stack to test any part of
1313
the process in the local system environment. Course and exercise

builder/views.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ def build_log_json(request, key):
209209

210210

211211
def get_client_ip(request):
212-
x_forwarded_for = request.META.get('HTTP_X_FORWARDED_FOR')
212+
x_forwarded_for = request.headers.get('x-forwarded-for')
213213
if x_forwarded_for:
214214
return x_forwarded_for.split(',')[0]
215215
return request.META.get('REMOTE_ADDR')
@@ -269,7 +269,7 @@ def hook(request: Request, key: str, **kwargs) -> HttpResponse:
269269
return HttpResponse(f"No access to course {key}", status=403)
270270
else:
271271
branch = None
272-
if request.META.get('HTTP_X_GITLAB_EVENT'):
272+
if request.headers.get('x-gitlab-event'):
273273
if course.webhook_secret is None:
274274
logger.warning(f"webhook secret for course '{key}' is None. Skipping secret verification.")
275275
else:
@@ -281,7 +281,7 @@ def hook(request: Request, key: str, **kwargs) -> HttpResponse:
281281
data = get_post_data(request)
282282
if data:
283283
branch = data.get('ref', '').rpartition("/")[2]
284-
elif request.META.get('HTTP_X_GITHUB_EVENT'):
284+
elif request.headers.get('x-github-event'):
285285
if course.webhook_secret is None:
286286
logger.warning(f"webhook secret for course '{key}' is None. Skipping secret verification.")
287287
else:
@@ -325,7 +325,7 @@ def hook(request: Request, key: str, **kwargs) -> HttpResponse:
325325

326326
push_event(key, **params)
327327

328-
if request.META.get('HTTP_REFERER'):
328+
if request.headers.get('referer'):
329329
return redirect('manager-updates', course.key)
330330

331331
return HttpResponse('ok')

docker/Dockerfile

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM --platform=$TARGETPLATFORM apluslms/service-base:django-1.18
1+
FROM apluslms/service-base:django-1.19
22

33
# Set container related configuration via environment variables.
44
ENV CONTAINER_TYPE="gitmanager" \
@@ -18,12 +18,13 @@ RUN : \
1818
# install docker-ce
1919
&& if [ "$TARGETPLATFORM" = "linux/amd64" ] ; then ARCH=amd64 ; elif [ "$TARGETPLATFORM" = "linux/arm64" ] ; then ARCH=arm64 ; else exit 1 ; fi \
2020
&& curl -LSs https://download.docker.com/linux/debian/gpg | gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg >/dev/null 2>&1 \
21-
&& echo "deb [arch=$ARCH signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/debian bullseye stable" > /etc/apt/sources.list.d/docker.list \
21+
&& echo "deb [arch=$ARCH signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/debian trixie stable" > /etc/apt/sources.list.d/docker.list \
2222
&& apt_install docker-ce \
2323
\
2424
# create user
2525
&& adduser --system --no-create-home --disabled-password --gecos "Git Manager webapp server,,," --home /srv/gitmanager --ingroup nogroup gitmanager \
2626
&& mkdir /srv/gitmanager && chown gitmanager.nogroup /srv/gitmanager \
27+
&& git config --system --add safe.directory '/srv/courses/source/*' \
2728
&& rm -rf /etc/init.d/ /tmp/* \
2829
# database settings that allow the Huey worker container to connect to the gitmanager web app's database
2930
&& find /etc/postgresql/*/*/ -type f -name pg_hba.conf -exec sh -c 'echo "host all all samenet trust" >> "$1"' -- {} \; \

requirements.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
Django ~= 4.2.3
2-
git+https://github.com/apluslms/django-essentials.git@1.6.0#egg=django-essentials==1.6.0
1+
Django ~= 5.2.13
2+
git+https://github.com/apluslms/django-essentials.git@1.7.0#egg=django-essentials
33
requests >= 2.28.0, < 3
44
PyYAML ~= 6.0.0
55
docutils ~= 0.17.1

0 commit comments

Comments
 (0)