Skip to content

Commit

Permalink
fix: Hall of Yakumans and CSRF failing on login form
Browse files Browse the repository at this point in the history
  • Loading branch information
m4tx committed Aug 20, 2024
1 parent 8b83c3d commit 3f39da4
Show file tree
Hide file tree
Showing 8 changed files with 60 additions and 55 deletions.
1 change: 1 addition & 0 deletions .env.prod.example
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
DEBUG=0
SECRET_KEY=CHANGE_ME
DJANGO_ALLOWED_HOSTS=fanpai.chombo.club,yakuman.chombo.club
DJANGO_CSRF_TRUSTED_ORIGINS=https://fanpai.chombo.club,https://yakuman.chombo.club
DJANGO_PARENT_HOST=chombo.club
SQL_ENGINE=django.db.backends.postgresql
SQL_DATABASE=kcc3
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ ENV PYTHONUNBUFFERED 1

RUN apt-get update && \
apt-get -y upgrade && \
apt-get install -y netcat-openbsd zlib1g-dev libjpeg-dev gcc
apt-get install -y netcat-openbsd zlib1g-dev libjpeg-dev gcc libimage-exiftool-perl

RUN pip install --upgrade pip
COPY pyproject.toml pyproject.toml
Expand Down
2 changes: 2 additions & 0 deletions badges/views.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import django.conf
from django.contrib import messages
from django.db import IntegrityError
from django.db.models import Count
Expand All @@ -19,6 +20,7 @@ class BadgeRankingView(ListView):
template_name = "badges/ranking.html"

def get_queryset(self):
print(django.conf.settings.CSRF_TRUSTED_ORIGINS)
players = Player.objects.all().annotate(num_badges=Count("badge")).order_by("-num_badges")

for i in range(len(players)):
Expand Down
2 changes: 1 addition & 1 deletion docker-compose.dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ services:
- static_volume:/app/static
- media_volume:/app/media
ports:
- 8000:80
- "8000:80"
depends_on:
- web

Expand Down
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,6 @@ services:
- ./static_files:/app/static
- ./media_files:/app/media
ports:
- 8000:80
- "8000:80"
depends_on:
- web
1 change: 1 addition & 0 deletions kcc3/settings/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
ALLOWED_HOSTS = os.environ.get("DJANGO_ALLOWED_HOSTS", "fanpai.localhost,yakuman.localhost,localhost,127.0.0.1").split(
","
)
CSRF_TRUSTED_ORIGINS = list(filter(None, os.environ.get("DJANGO_CSRF_TRUSTED_ORIGINS", "").split(",")))
PARENT_HOST = os.environ.get("DJANGO_PARENT_HOST", "localhost:8000")


Expand Down
101 changes: 51 additions & 50 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 @@ -9,11 +9,11 @@ readme = "README.md"
[tool.poetry.dependencies]
python = "^3.11"
celery = "5.4.0"
django = "4.2.15"
django = "5.0.8"
django-celery-beat = "2.6.0"
django-hosts = "6.0"
djangorestframework = "3.15.2"
gunicorn = "22.0.0"
gunicorn = "23.0.0"
pillow = "10.4.0"
psycopg2-binary = "2.9.9"
pytz = "2024.1"
Expand Down

0 comments on commit 3f39da4

Please sign in to comment.