diff --git a/.vscode/launch.json b/.vscode/launch.json index 71a5854..340195f 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -9,7 +9,7 @@ "args": ["runserver"], "django": true, "justMyCode": true, - "preLaunchTask": "Run db" + "preLaunchTask": "Run db standalone" } ] } \ No newline at end of file diff --git a/.vscode/tasks.json b/.vscode/tasks.json index cbbe65b..8dc5909 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -8,15 +8,21 @@ "problemMatcher": [] }, { - "label": "Run app & db (db in docker)", + "label": "Build & run app", "type": "shell", - "command": "./scripts/entrypoint.sh", + "command": "docker compose up --build", "problemMatcher": [] }, { - "label": "Run app & db (both in Docker)", + "label": "Build & run app (no build cache)", "type": "shell", - "command": "docker compose -f docker-compose_entire_app.yml up", + "command": "docker compose up --build --no-cache", + "problemMatcher": [] + }, + { + "label": "Run db standalone", + "type": "shell", + "command": "docker compose up -d db", "problemMatcher": [] }, { @@ -24,12 +30,6 @@ "type": "shell", "command": "cd theme/static_src && npm run dev", "problemMatcher": [], - }, - { - "label": "Run db", - "type": "shell", - "command": "docker compose -f docker-compose_db_only.yml up", - "problemMatcher": [] } ] } \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index db6d9bd..c112cf3 100644 --- a/Dockerfile +++ b/Dockerfile @@ -94,4 +94,4 @@ EXPOSE 8000 HEALTHCHECK CMD curl --fail http://localhost:8000/health/ || exit 1 -CMD ["granian", "--interface", "wsgi", "django_project.wsgi", "--host", "0.0.0.0", "--port", "8000", "--workers", "1", "--respawn-failed-workers", "--workers-kill-timeout", "60"] +CMD ["granian", "--interface", "wsgi", "pkmntrade_club.django_project.wsgi", "--host", "0.0.0.0", "--port", "8000", "--workers", "1", "--respawn-failed-workers", "--workers-kill-timeout", "60"] diff --git a/MANIFEST.in b/MANIFEST.in index 9eba189..5067ddb 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,29 +1,30 @@ include README.md include LICENSE -graft accounts/templates -graft accounts/migrations +graft src/pkmntrade_club/accounts/templates +graft src/pkmntrade_club/accounts/migrations -graft cards/templates -graft cards/migrations +graft src/pkmntrade_club/cards/templates +graft src/pkmntrade_club/cards/migrations -graft home/migrations +graft src/pkmntrade_club/home/migrations -graft theme/templates -graft theme/templatetags -graft theme/static +graft src/pkmntrade_club/theme/templates +graft src/pkmntrade_club/theme/templatetags +graft src/pkmntrade_club/theme/static -graft trades/templates -graft trades/migrations +graft src/pkmntrade_club/trades/templates +graft src/pkmntrade_club/trades/migrations -graft static +graft src/pkmntrade_club/static -recursive-include accounts *.py -recursive-include cards *.py -recursive-include common *.py -recursive-include django_project *.py -recursive-include home *.py -recursive-include theme *.py -recursive-include trades *.py +recursive-include src/pkmntrade_club/accounts *.html *.py +recursive-include src/pkmntrade_club/cards *.html *.py +recursive-include src/pkmntrade_club/common *.html *.py +recursive-include src/pkmntrade_club/django_project *.html *.py +recursive-include src/pkmntrade_club/home *.html *.py +recursive-include src/pkmntrade_club/static * +recursive-include src/pkmntrade_club/theme *.html *.py +recursive-include src/pkmntrade_club/trades *.html *.py global-exclude *.py[cod] __pycache__ .DS_Store .* diff --git a/django_project/wsgi.py b/django_project/wsgi.py deleted file mode 100644 index 3611700..0000000 --- a/django_project/wsgi.py +++ /dev/null @@ -1,9 +0,0 @@ -import os - -from django.core.wsgi import get_wsgi_application - -os.environ.setdefault("DJANGO_SETTINGS_MODULE", "django_project.settings") - -# use app for granian, application for gunicorn -app = get_wsgi_application() -application = app diff --git a/docker-compose.yml b/docker-compose.yml index 526c5d2..db8d728 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,26 +1,27 @@ services: loba: - image: lucaslorentz/caddy-docker-proxy:2.9 + image: haproxy:3.1 + stop_signal: SIGTERM ports: - 8000:8000 volumes: - - /var/run/docker.sock:/var/run/docker.sock - - caddy_data:/data + - ./haproxy/haproxy.dev.cfg:/usr/local/etc/haproxy/haproxy.cfg depends_on: - web web: build: . volumes: - #- ./seed:/seed:ro - ./.env.dev:/.env:ro - #- ./src:/src + - ./seed:/seed:ro + - ./src/pkmntrade_club/accounts/migrations:/app/lib/python3.12/site-packages/pkmntrade_club/accounts/migrations # for makemigrations + - ./src/pkmntrade_club/cards/migrations:/app/lib/python3.12/site-packages/pkmntrade_club/cards/migrations # for makemigrations + - ./src/pkmntrade_club/trades/migrations:/app/lib/python3.12/site-packages/pkmntrade_club/trades/migrations # for makemigrations + - ./src/pkmntrade_club/home/migrations:/app/lib/python3.12/site-packages/pkmntrade_club/home/migrations # for makemigrations env_file: - .env.dev - labels: - caddy: ":8000" - caddy.reverse_proxy: "{{upstreams 8000}}" depends_on: - - db + db: + condition: service_healthy db: image: postgres:16 ports: @@ -29,9 +30,11 @@ services: - postgres_data:/var/lib/postgresql/data/ environment: - "POSTGRES_HOST_AUTH_METHOD=trust" + healthcheck: + test: ["CMD", "pg_isready", "-U", "postgres", "-d", "postgres"] + interval: 10s + timeout: 5s + retries: 5 volumes: - postgres_data: - labels: - - "db_is_resettable_via_script" - caddy_data: \ No newline at end of file + postgres_data: \ No newline at end of file diff --git a/docker-compose_prod.yml b/docker-compose_prod.yml index fc8209a..715b5c6 100644 --- a/docker-compose_prod.yml +++ b/docker-compose_prod.yml @@ -1,26 +1,21 @@ services: loba: - image: lucaslorentz/caddy-docker-proxy:2.9 + image: haproxy:3.1 + stop_signal: SIGTERM ports: - - 8000:8000 + - 443:443 + entrypoint: ["/usr/local/bin/haproxy.entrypoint.sh"] volumes: - - /var/run/docker.sock:/var/run/docker.sock - - caddy_data:/data + - ./haproxy/haproxy.cfg:/usr/local/etc/haproxy/haproxy.cfg + - ./scripts/haproxy.entrypoint.sh:/usr/local/bin/haproxy.entrypoint.sh depends_on: - web web: build: . volumes: - - ./seed:/seed:ro - ./.env.production:/.env:ro env_file: - .env.production deploy: mode: replicated - replicas: 4 - labels: - caddy: ":8000" - caddy.reverse_proxy: "{{upstreams 8000}}" - -volumes: - caddy_data: \ No newline at end of file + replicas: 4 \ No newline at end of file diff --git a/haproxy/haproxy.cfg b/haproxy/haproxy.cfg new file mode 100644 index 0000000..a8a6ffb --- /dev/null +++ b/haproxy/haproxy.cfg @@ -0,0 +1,21 @@ +defaults + mode http + timeout client 10s + timeout connect 5s + timeout server 10s + timeout http-request 10s + +frontend cf + bind :443 ssl crt /certs/crt.pem verify required #ca-file /certs/ca.pem + default_backend django + +backend django + balance leastconn + option httpchk + http-check send meth GET uri /health/ + http-check expect string OK/HEALTHY + default-server check maxconn 10000 observe layer7 + server django1 pkmntradeclub-web-1:8000 + server django2 pkmntradeclub-web-2:8000 + server django3 pkmntradeclub-web-3:8000 + server django4 pkmntradeclub-web-4:8000 diff --git a/haproxy/haproxy.dev.cfg b/haproxy/haproxy.dev.cfg new file mode 100644 index 0000000..ac27c8d --- /dev/null +++ b/haproxy/haproxy.dev.cfg @@ -0,0 +1,18 @@ +defaults + mode http + timeout client 10s + timeout connect 5s + timeout server 10s + timeout http-request 10s + +frontend cf + bind :8000 + default_backend django + +backend django + option httpchk + http-check send meth GET uri /health/ + http-check expect string OK/HEALTHY + default-server check maxconn 10000 observe layer7 + server django web:8000 + \ No newline at end of file diff --git a/manage.py b/manage.py index c49d330..696a354 100755 --- a/manage.py +++ b/manage.py @@ -3,10 +3,9 @@ import os import sys - def main(): """Run administrative tasks.""" - os.environ.setdefault("DJANGO_SETTINGS_MODULE", "django_project.settings") + os.environ.setdefault("DJANGO_SETTINGS_MODULE", "pkmntrade_club.django_project.settings") try: from django.core.management import execute_from_command_line except ImportError as exc: diff --git a/pyproject.toml b/pyproject.toml index c09624d..93480ef 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -72,14 +72,5 @@ pkmntrade-manage = "manage:main" [project.urls] Homepage = "https://pkmntrade.club" -[tool.setuptools] -packages = [ - "accounts", - "cards", - "common", - "django_project", - "home", - "static", - "theme", - "trades" -] +[tool.setuptools.packages.find] +where = ["src"] diff --git a/scripts/deploy.sh b/scripts/deploy.sh index 26c3c87..76e3d3e 100755 --- a/scripts/deploy.sh +++ b/scripts/deploy.sh @@ -1,15 +1,15 @@ #!/bin/bash -echo "Running makemigrations --check to make sure migrations are up to date..." -django-admin makemigrations --noinput --check 2>&1 +echo "*** Running makemigrations --check to make sure migrations are up to date..." +django-admin makemigrations --check --noinput 2>&1 || exit 1 -echo "Running migrate to apply migrations..." +echo "*** Running migrate to apply migrations..." django-admin migrate --noinput 2>&1 -echo "Clearing django cache..." +echo "*** Clearing django cache..." django-admin clear_cache 2>&1 -echo "Running collectstatic..." +echo "*** Running collectstatic..." django-admin collectstatic -c --no-input 2>&1 -echo "Deployed successfully!" \ No newline at end of file +echo "*** Deployed successfully!" \ No newline at end of file diff --git a/scripts/haproxy.entrypoint.sh b/scripts/haproxy.entrypoint.sh new file mode 100644 index 0000000..2557fe6 --- /dev/null +++ b/scripts/haproxy.entrypoint.sh @@ -0,0 +1,25 @@ +#!/bin/sh + +CERT_PATH="/certs/crt.pem" +CA_PATH="/certs/ca.pem" + +# Create the directory if it doesn't exist +mkdir -p "$(dirname "$CERT_PATH")" "$(dirname "$CA_PATH")" + +if [ -n "$HAPROXY_PEM_CERT" ]; then + printf "%s" "$HAPROXY_PEM_CERT" > "$CERT_PATH" + chmod 600 "$CERT_PATH" + echo "HAProxy SSL certificate written to $CERT_PATH" +else + echo "Warning: HAPROXY_PEM_CERT environment variable is not set. SSL may not be configured." +fi + +if [ -n "$HAPROXY_PEM_CA" ]; then + printf "%s" "$HAPROXY_PEM_CA" > "$CA_PATH" + chmod 600 "$CA_PATH" # Set restrictive permissions + echo "HAProxy SSL CA written to $CA_PATH" +else + echo "Warning: HAPROXY_PEM_CA environment variable is not set. SSL may not be configured." +fi + +exec /usr/local/bin/docker-entrypoint.sh "$@" diff --git a/scripts/prebuild.sh b/scripts/prebuild.sh index 555b48d..e93a7a2 100755 --- a/scripts/prebuild.sh +++ b/scripts/prebuild.sh @@ -7,6 +7,6 @@ if [ -d "staticfiles" ]; then fi # Build the tailwind theme css -cd theme/static_src +cd src/pkmntrade_club/theme/static_src npm install . && npm run build cd ../../ \ No newline at end of file diff --git a/scripts/reset-db_make-migrations_seed-data.sh b/scripts/reset-db_make-migrations_seed-data.sh index 58cf0c6..18630bd 100755 --- a/scripts/reset-db_make-migrations_seed-data.sh +++ b/scripts/reset-db_make-migrations_seed-data.sh @@ -2,18 +2,23 @@ # Exit immediately if any command exits with a non-zero status. set -e -# Reset the database and migrations. -echo "Resetting database and migrations... " +echo "Remaking migrations..." +docker compose up -d +find . -path "*/migrations/0*.py" -delete +docker compose exec -it web bash -c "django-admin makemigrations --noinput" + +echo "Resetting database... " docker compose down \ - && docker volume prune -a --filter label=db_is_resettable_via_script \ - && find . -path "*/migrations/00*.py" -delete \ + && docker volume rm -f pkmntradeclub_postgres_data \ && docker compose up -d # Wait for the database to be ready. -echo "Waiting for the database to be ready..." +echo "Waiting for the database to be ready, and migrations to be autorun..." sleep 10 echo "Loading seed data..." docker compose exec -it web bash -c "django-admin loaddata /seed/0*" -echo "Done & Started!" +docker compose down + +echo "Done!" diff --git a/accounts/__init__.py b/src/pkmntrade_club/__init__.py similarity index 100% rename from accounts/__init__.py rename to src/pkmntrade_club/__init__.py diff --git a/accounts/management/__init__.py b/src/pkmntrade_club/accounts/__init__.py similarity index 100% rename from accounts/management/__init__.py rename to src/pkmntrade_club/accounts/__init__.py diff --git a/accounts/admin.py b/src/pkmntrade_club/accounts/admin.py similarity index 100% rename from accounts/admin.py rename to src/pkmntrade_club/accounts/admin.py diff --git a/accounts/apps.py b/src/pkmntrade_club/accounts/apps.py similarity index 77% rename from accounts/apps.py rename to src/pkmntrade_club/accounts/apps.py index 3e3c765..df72a2b 100644 --- a/accounts/apps.py +++ b/src/pkmntrade_club/accounts/apps.py @@ -3,4 +3,4 @@ from django.apps import AppConfig class AccountsConfig(AppConfig): default_auto_field = 'django.db.models.BigAutoField' - name = 'accounts' + name = 'pkmntrade_club.accounts' diff --git a/accounts/forms.py b/src/pkmntrade_club/accounts/forms.py similarity index 100% rename from accounts/forms.py rename to src/pkmntrade_club/accounts/forms.py diff --git a/accounts/management/commands/__init__.py b/src/pkmntrade_club/accounts/management/__init__.py similarity index 100% rename from accounts/management/commands/__init__.py rename to src/pkmntrade_club/accounts/management/__init__.py diff --git a/accounts/migrations/__init__.py b/src/pkmntrade_club/accounts/management/commands/__init__.py similarity index 100% rename from accounts/migrations/__init__.py rename to src/pkmntrade_club/accounts/management/commands/__init__.py diff --git a/accounts/management/commands/clear_cache.py b/src/pkmntrade_club/accounts/management/commands/clear_cache.py similarity index 100% rename from accounts/management/commands/clear_cache.py rename to src/pkmntrade_club/accounts/management/commands/clear_cache.py diff --git a/accounts/migrations/0001_initial.py b/src/pkmntrade_club/accounts/migrations/0001_initial.py similarity index 96% rename from accounts/migrations/0001_initial.py rename to src/pkmntrade_club/accounts/migrations/0001_initial.py index 9273981..d28133b 100644 --- a/accounts/migrations/0001_initial.py +++ b/src/pkmntrade_club/accounts/migrations/0001_initial.py @@ -1,10 +1,10 @@ -# Generated by Django 5.1 on 2025-05-09 01:49 +# Generated by Django 5.1 on 2025-05-10 01:22 -import accounts.models import django.contrib.auth.models import django.contrib.auth.validators import django.db.models.deletion import django.utils.timezone +import pkmntrade_club.accounts.models from django.conf import settings from django.db import migrations, models @@ -51,7 +51,7 @@ class Migration(migrations.Migration): name='FriendCode', fields=[ ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('friend_code', models.CharField(max_length=19, validators=[accounts.models.validate_friend_code])), + ('friend_code', models.CharField(max_length=19, validators=[pkmntrade_club.accounts.models.validate_friend_code])), ('in_game_name', models.CharField(max_length=14)), ('created_at', models.DateTimeField(auto_now_add=True)), ('updated_at', models.DateTimeField(auto_now=True)), diff --git a/cards/__init__.py b/src/pkmntrade_club/accounts/migrations/__init__.py similarity index 100% rename from cards/__init__.py rename to src/pkmntrade_club/accounts/migrations/__init__.py diff --git a/accounts/migrations/max_migration.txt b/src/pkmntrade_club/accounts/migrations/max_migration.txt similarity index 100% rename from accounts/migrations/max_migration.txt rename to src/pkmntrade_club/accounts/migrations/max_migration.txt diff --git a/accounts/models.py b/src/pkmntrade_club/accounts/models.py similarity index 100% rename from accounts/models.py rename to src/pkmntrade_club/accounts/models.py diff --git a/accounts/templatetags/gravatar.py b/src/pkmntrade_club/accounts/templatetags/gravatar.py similarity index 100% rename from accounts/templatetags/gravatar.py rename to src/pkmntrade_club/accounts/templatetags/gravatar.py diff --git a/accounts/tests.py b/src/pkmntrade_club/accounts/tests.py similarity index 98% rename from accounts/tests.py rename to src/pkmntrade_club/accounts/tests.py index 392f3e7..b6c8695 100644 --- a/accounts/tests.py +++ b/src/pkmntrade_club/accounts/tests.py @@ -8,10 +8,10 @@ from django.urls import reverse from django.core.exceptions import ValidationError from django.contrib.sessions.middleware import SessionMiddleware -from accounts.models import FriendCode -from accounts.forms import FriendCodeForm, CustomUserCreationForm, UserSettingsForm -from accounts.templatetags import gravatar -from trades.models import TradeOffer +from pkmntrade_club.accounts.models import FriendCode +from pkmntrade_club.accounts.forms import FriendCodeForm, CustomUserCreationForm, UserSettingsForm +from pkmntrade_club.accounts.templatetags import gravatar +from pkmntrade_club.trades.models import TradeOffer from tests.utils.rarity import RARITY_MAPPING # Create your tests here. @@ -605,7 +605,7 @@ class TemplateTagTests(TestCase): self.assertIn('img src="', result) self.assertIn(f'width="{size}"', result) - @patch("accounts.templatetags.gravatar.requests.get") + @patch("pkmntrade_club.accounts.templatetags.gravatar.requests.get") def test_gravatar_profile_data_success(self, mock_get): """Test that gravatar_profile_data returns the first entry when JSON response is valid.""" dummy_entry = {"name": "Test User"} @@ -616,7 +616,7 @@ class TemplateTagTests(TestCase): data = gravatar.gravatar_profile_data("user@example.com") self.assertEqual(data, dummy_entry) - @patch("accounts.templatetags.gravatar.requests.get") + @patch("pkmntrade_club.accounts.templatetags.gravatar.requests.get") def test_gravatar_profile_data_failure(self, mock_get): """ If requests.get fails or the JSON is not valid, diff --git a/accounts/urls.py b/src/pkmntrade_club/accounts/urls.py similarity index 100% rename from accounts/urls.py rename to src/pkmntrade_club/accounts/urls.py diff --git a/accounts/views.py b/src/pkmntrade_club/accounts/views.py similarity index 97% rename from accounts/views.py rename to src/pkmntrade_club/accounts/views.py index ceb176d..fbecc1e 100644 --- a/accounts/views.py +++ b/src/pkmntrade_club/accounts/views.py @@ -3,13 +3,13 @@ from django.contrib.auth.mixins import LoginRequiredMixin from django.urls import reverse_lazy from django.shortcuts import redirect, get_object_or_404, render from django.views.generic import ListView, CreateView, DeleteView, View, TemplateView, UpdateView -from accounts.models import FriendCode, CustomUser -from accounts.forms import FriendCodeForm, UserSettingsForm +from pkmntrade_club.accounts.models import FriendCode, CustomUser +from pkmntrade_club.accounts.forms import FriendCodeForm, UserSettingsForm from django.db.models import Case, When, Value, BooleanField -from trades.models import TradeOffer, TradeAcceptance +from pkmntrade_club.trades.models import TradeOffer, TradeAcceptance from django.core.exceptions import PermissionDenied -from trades.mixins import FriendCodeRequiredMixin -from common.mixins import ReusablePaginationMixin +from pkmntrade_club.trades.mixins import FriendCodeRequiredMixin +from pkmntrade_club.common.mixins import ReusablePaginationMixin from django.urls import reverse from django.utils.http import urlencode @@ -140,7 +140,7 @@ class DashboardView(LoginRequiredMixin, FriendCodeRequiredMixin, ReusablePaginat def post(self, request, *args, **kwargs): if 'update_settings' in request.POST: - from accounts.forms import UserSettingsForm + from pkmntrade_club.accounts.forms import UserSettingsForm form = UserSettingsForm(request.POST, instance=request.user) if form.is_valid(): form.save() @@ -314,7 +314,7 @@ class DashboardView(LoginRequiredMixin, FriendCodeRequiredMixin, ReusablePaginat context["closed_acceptances_paginated"] = self.get_closed_acceptances_paginated(closed_acceptances_page) context["rejected_by_me_paginated"] = self.get_rejected_by_me_paginated(rejected_by_me_page) context["rejected_by_them_paginated"] = self.get_rejected_by_them_paginated(rejected_by_them_page) - from accounts.forms import UserSettingsForm + from pkmntrade_club.accounts.forms import UserSettingsForm context["settings_form"] = UserSettingsForm(instance=request.user) context["active_tab"] = request.GET.get("tab", "dash") return context diff --git a/cards/migrations/__init__.py b/src/pkmntrade_club/cards/__init__.py similarity index 100% rename from cards/migrations/__init__.py rename to src/pkmntrade_club/cards/__init__.py diff --git a/cards/admin.py b/src/pkmntrade_club/cards/admin.py similarity index 100% rename from cards/admin.py rename to src/pkmntrade_club/cards/admin.py diff --git a/cards/apps.py b/src/pkmntrade_club/cards/apps.py similarity index 53% rename from cards/apps.py rename to src/pkmntrade_club/cards/apps.py index e81dde5..3e27ef3 100644 --- a/cards/apps.py +++ b/src/pkmntrade_club/cards/apps.py @@ -2,7 +2,7 @@ from django.apps import AppConfig class CardsConfig(AppConfig): - name = "cards" + name = "pkmntrade_club.cards" def ready(self): - import cards.signals \ No newline at end of file + import pkmntrade_club.cards.signals \ No newline at end of file diff --git a/cards/migrations/0001_initial.py b/src/pkmntrade_club/cards/migrations/0001_initial.py similarity index 98% rename from cards/migrations/0001_initial.py rename to src/pkmntrade_club/cards/migrations/0001_initial.py index 1bbde40..03a0132 100644 --- a/cards/migrations/0001_initial.py +++ b/src/pkmntrade_club/cards/migrations/0001_initial.py @@ -1,4 +1,4 @@ -# Generated by Django 5.1 on 2025-05-09 01:49 +# Generated by Django 5.1 on 2025-05-10 01:22 import django.db.models.deletion from django.db import migrations, models diff --git a/cards/templatetags/__init__.py b/src/pkmntrade_club/cards/migrations/__init__.py similarity index 100% rename from cards/templatetags/__init__.py rename to src/pkmntrade_club/cards/migrations/__init__.py diff --git a/cards/migrations/max_migration.txt b/src/pkmntrade_club/cards/migrations/max_migration.txt similarity index 100% rename from cards/migrations/max_migration.txt rename to src/pkmntrade_club/cards/migrations/max_migration.txt diff --git a/cards/mixins.py b/src/pkmntrade_club/cards/mixins.py similarity index 100% rename from cards/mixins.py rename to src/pkmntrade_club/cards/mixins.py diff --git a/cards/models.py b/src/pkmntrade_club/cards/models.py similarity index 100% rename from cards/models.py rename to src/pkmntrade_club/cards/models.py diff --git a/cards/signals.py b/src/pkmntrade_club/cards/signals.py similarity index 100% rename from cards/signals.py rename to src/pkmntrade_club/cards/signals.py diff --git a/common/__init__.py b/src/pkmntrade_club/cards/templatetags/__init__.py similarity index 100% rename from common/__init__.py rename to src/pkmntrade_club/cards/templatetags/__init__.py diff --git a/cards/templatetags/card_badge.py b/src/pkmntrade_club/cards/templatetags/card_badge.py similarity index 100% rename from cards/templatetags/card_badge.py rename to src/pkmntrade_club/cards/templatetags/card_badge.py diff --git a/cards/templatetags/card_multiselect.py b/src/pkmntrade_club/cards/templatetags/card_multiselect.py similarity index 98% rename from cards/templatetags/card_multiselect.py rename to src/pkmntrade_club/cards/templatetags/card_multiselect.py index 9952cb0..dc03500 100644 --- a/cards/templatetags/card_multiselect.py +++ b/src/pkmntrade_club/cards/templatetags/card_multiselect.py @@ -1,6 +1,6 @@ import uuid from django import template -from cards.models import Card +from pkmntrade_club.cards.models import Card from django.db.models.query import QuerySet import json import hashlib diff --git a/cards/tests.py b/src/pkmntrade_club/cards/tests.py similarity index 97% rename from cards/tests.py rename to src/pkmntrade_club/cards/tests.py index 13c55a7..75e73b8 100644 --- a/cards/tests.py +++ b/src/pkmntrade_club/cards/tests.py @@ -5,10 +5,10 @@ from datetime import timedelta from django.urls import reverse from django.utils import timezone -from accounts.models import CustomUser, FriendCode -from cards.models import Card, Deck, DeckNameTranslation, CardNameTranslation -from trades.models import TradeOffer, TradeOfferHaveCard, TradeOfferWantCard -from cards.templatetags import card_badge, card_multiselect +from pkmntrade_club.accounts.models import CustomUser, FriendCode +from pkmntrade_club.cards.models import Card, Deck, DeckNameTranslation, CardNameTranslation +from pkmntrade_club.trades.models import TradeOffer, TradeOfferHaveCard, TradeOfferWantCard +from pkmntrade_club.cards.templatetags import card_badge, card_multiselect from tests.utils.rarity import RARITY_MAPPING class CardsModelsTests(TestCase): diff --git a/cards/urls.py b/src/pkmntrade_club/cards/urls.py similarity index 100% rename from cards/urls.py rename to src/pkmntrade_club/cards/urls.py diff --git a/cards/views.py b/src/pkmntrade_club/cards/views.py similarity index 97% rename from cards/views.py rename to src/pkmntrade_club/cards/views.py index b1bfcbb..08a7bb0 100644 --- a/cards/views.py +++ b/src/pkmntrade_club/cards/views.py @@ -1,9 +1,9 @@ from django.views.generic import TemplateView from django.urls import reverse_lazy from django.views.generic import UpdateView, DeleteView, CreateView, ListView, DetailView -from cards.models import Card -from trades.models import TradeOffer -from common.mixins import ReusablePaginationMixin +from pkmntrade_club.cards.models import Card +from pkmntrade_club.trades.models import TradeOffer +from pkmntrade_club.common.mixins import ReusablePaginationMixin from django.views import View from django.shortcuts import get_object_or_404, render diff --git a/common/templatetags/__init__.py b/src/pkmntrade_club/common/__init__.py similarity index 100% rename from common/templatetags/__init__.py rename to src/pkmntrade_club/common/__init__.py diff --git a/src/pkmntrade_club/common/apps.py b/src/pkmntrade_club/common/apps.py new file mode 100644 index 0000000..6e2cde5 --- /dev/null +++ b/src/pkmntrade_club/common/apps.py @@ -0,0 +1,8 @@ +from django.apps import AppConfig + + +class CommonConfig(AppConfig): + name = "pkmntrade_club.common" + + def ready(self): + pass \ No newline at end of file diff --git a/common/context_processors.py b/src/pkmntrade_club/common/context_processors.py similarity index 100% rename from common/context_processors.py rename to src/pkmntrade_club/common/context_processors.py diff --git a/common/mixins.py b/src/pkmntrade_club/common/mixins.py similarity index 100% rename from common/mixins.py rename to src/pkmntrade_club/common/mixins.py diff --git a/django_project/__init__.py b/src/pkmntrade_club/common/templatetags/__init__.py similarity index 100% rename from django_project/__init__.py rename to src/pkmntrade_club/common/templatetags/__init__.py diff --git a/common/templatetags/pagination_tags.py b/src/pkmntrade_club/common/templatetags/pagination_tags.py similarity index 100% rename from common/templatetags/pagination_tags.py rename to src/pkmntrade_club/common/templatetags/pagination_tags.py diff --git a/home/__init__.py b/src/pkmntrade_club/django_project/__init__.py similarity index 100% rename from home/__init__.py rename to src/pkmntrade_club/django_project/__init__.py diff --git a/django_project/asgi.py b/src/pkmntrade_club/django_project/asgi.py similarity index 52% rename from django_project/asgi.py rename to src/pkmntrade_club/django_project/asgi.py index fc0ec52..11400ef 100644 --- a/django_project/asgi.py +++ b/src/pkmntrade_club/django_project/asgi.py @@ -2,6 +2,6 @@ import os from django.core.asgi import get_asgi_application -os.environ.setdefault("DJANGO_SETTINGS_MODULE", "django_project.settings") +os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'pkmntrade_club.django_project.settings') application = get_asgi_application() diff --git a/django_project/middleware.py b/src/pkmntrade_club/django_project/middleware.py similarity index 87% rename from django_project/middleware.py rename to src/pkmntrade_club/django_project/middleware.py index 390e7d1..36103fe 100644 --- a/django_project/middleware.py +++ b/src/pkmntrade_club/django_project/middleware.py @@ -7,6 +7,8 @@ class LogRequestsMiddleware: self.get_response = get_response def __call__(self, request): + if request.path == "/health/": + return self.get_response(request) start = time.perf_counter() response = self.get_response(request) end = time.perf_counter() diff --git a/django_project/settings.py b/src/pkmntrade_club/django_project/settings.py similarity index 94% rename from django_project/settings.py rename to src/pkmntrade_club/django_project/settings.py index d8fce03..73beb81 100644 --- a/django_project/settings.py +++ b/src/pkmntrade_club/django_project/settings.py @@ -70,12 +70,12 @@ ALLOWED_HOSTS = env('ALLOWED_HOSTS').split(',') CSRF_TRUSTED_ORIGINS = env('CSRF_TRUSTED_ORIGINS').split(',') FIRST_PARTY_APPS = [ - "theme", - "common", - "accounts", - "cards", - "home", - "trades" + 'pkmntrade_club.accounts', + 'pkmntrade_club.cards', + 'pkmntrade_club.common', + 'pkmntrade_club.home', + 'pkmntrade_club.theme', + 'pkmntrade_club.trades', ] # Application definition @@ -122,7 +122,7 @@ MIDDLEWARE = [ "django.contrib.messages.middleware.MessageMiddleware", "django.middleware.clickjacking.XFrameOptionsMiddleware", "allauth.account.middleware.AccountMiddleware", # django-allauth - "django_project.middleware.LogRequestsMiddleware", + "pkmntrade_club.django_project.middleware.LogRequestsMiddleware", ] if DEBUG: @@ -136,10 +136,12 @@ DAISY_SETTINGS = { } # https://docs.djangoproject.com/en/dev/ref/settings/#root-urlconf -ROOT_URLCONF = "django_project.urls" +ROOT_URLCONF = 'pkmntrade_club.django_project.urls' # https://docs.djangoproject.com/en/dev/ref/settings/#wsgi-application -WSGI_APPLICATION = "django_project.wsgi.application" +WSGI_APPLICATION = 'pkmntrade_club.django_project.wsgi.app' + +ASGI_APPLICATION = 'pkmntrade_club.django_project.asgi.application' # https://docs.djangoproject.com/en/dev/ref/settings/#templates TEMPLATES = [ @@ -153,7 +155,7 @@ TEMPLATES = [ "django.template.context_processors.request", "django.contrib.auth.context_processors.auth", "django.contrib.messages.context_processors.messages", - "common.context_processors.cache_settings", + "pkmntrade_club.common.context_processors.cache_settings", ], }, }, diff --git a/django_project/urls.py b/src/pkmntrade_club/django_project/urls.py similarity index 64% rename from django_project/urls.py rename to src/pkmntrade_club/django_project/urls.py index 505ad30..2cf77c2 100644 --- a/django_project/urls.py +++ b/src/pkmntrade_club/django_project/urls.py @@ -5,10 +5,10 @@ from django.urls import path, include urlpatterns = [ path("admin/", admin.site.urls), path("accounts/", include("allauth.urls")), - path("", include("home.urls")), - path("cards/", include("cards.urls")), - path('account/', include('accounts.urls')), - path("trades/", include("trades.urls")), + path("", include("pkmntrade_club.home.urls")), + path("cards/", include("pkmntrade_club.cards.urls")), + path('account/', include('pkmntrade_club.accounts.urls')), + path("trades/", include("pkmntrade_club.trades.urls")), path("__reload__/", include("django_browser_reload.urls")), ] diff --git a/src/pkmntrade_club/django_project/wsgi.py b/src/pkmntrade_club/django_project/wsgi.py new file mode 100644 index 0000000..4c5ab87 --- /dev/null +++ b/src/pkmntrade_club/django_project/wsgi.py @@ -0,0 +1,7 @@ +import os + +from django.core.wsgi import get_wsgi_application + +os.environ.setdefault("DJANGO_SETTINGS_MODULE", "pkmntrade_club.django_project.settings") + +app = get_wsgi_application() diff --git a/home/migrations/__init__.py b/src/pkmntrade_club/home/__init__.py similarity index 100% rename from home/migrations/__init__.py rename to src/pkmntrade_club/home/__init__.py diff --git a/home/admin.py b/src/pkmntrade_club/home/admin.py similarity index 100% rename from home/admin.py rename to src/pkmntrade_club/home/admin.py diff --git a/home/apps.py b/src/pkmntrade_club/home/apps.py similarity index 66% rename from home/apps.py rename to src/pkmntrade_club/home/apps.py index 620f8c5..c07eb2b 100644 --- a/home/apps.py +++ b/src/pkmntrade_club/home/apps.py @@ -2,4 +2,4 @@ from django.apps import AppConfig class HomeConfig(AppConfig): - name = "home" + name = "pkmntrade_club.home" diff --git a/static/__init__.py b/src/pkmntrade_club/home/migrations/__init__.py similarity index 100% rename from static/__init__.py rename to src/pkmntrade_club/home/migrations/__init__.py diff --git a/home/models.py b/src/pkmntrade_club/home/models.py similarity index 100% rename from home/models.py rename to src/pkmntrade_club/home/models.py diff --git a/home/tests.py b/src/pkmntrade_club/home/tests.py similarity index 98% rename from home/tests.py rename to src/pkmntrade_club/home/tests.py index 6083493..9c51303 100644 --- a/home/tests.py +++ b/src/pkmntrade_club/home/tests.py @@ -1,10 +1,10 @@ from django.test import TestCase, Client, RequestFactory from django.urls import reverse from django.contrib.auth import get_user_model -from cards.models import Card, Deck -from trades.models import TradeOffer, TradeOfferHaveCard, TradeOfferWantCard -from accounts.models import FriendCode -from home.views import HomePageView +from pkmntrade_club.cards.models import Card, Deck +from pkmntrade_club.trades.models import TradeOffer, TradeOfferHaveCard, TradeOfferWantCard +from pkmntrade_club.accounts.models import FriendCode +from pkmntrade_club.home.views import HomePageView import json from collections import OrderedDict from unittest.mock import patch, MagicMock diff --git a/home/urls.py b/src/pkmntrade_club/home/urls.py similarity index 100% rename from home/urls.py rename to src/pkmntrade_club/home/urls.py diff --git a/home/views.py b/src/pkmntrade_club/home/views.py similarity index 97% rename from home/views.py rename to src/pkmntrade_club/home/views.py index 28dd8a9..307b008 100644 --- a/home/views.py +++ b/src/pkmntrade_club/home/views.py @@ -4,8 +4,8 @@ from django.urls import reverse_lazy from django.db.models import Count, Q, Prefetch, Sum, F, IntegerField, Value, BooleanField, Case, When from django.db.models.functions import Coalesce from django.core.paginator import Paginator, EmptyPage, PageNotAnInteger -from trades.models import TradeOffer, TradeAcceptance, TradeOfferHaveCard, TradeOfferWantCard -from cards.models import Card +from pkmntrade_club.trades.models import TradeOffer, TradeAcceptance, TradeOfferHaveCard, TradeOfferWantCard +from pkmntrade_club.cards.models import Card from django.utils.decorators import method_decorator from django.template.response import TemplateResponse from django.http import HttpResponseRedirect @@ -147,7 +147,7 @@ class HealthCheckView(View): return HttpResponse("Database connection failed", status=500) try: - from trades.models import TradeOffer + from pkmntrade_club.trades.models import TradeOffer with contextlib.redirect_stdout(None): print(TradeOffer.objects.count()) except Exception as e: @@ -161,5 +161,4 @@ class HealthCheckView(View): except Exception as e: return HttpResponse("Cache not reachable", status=500) - logger.info("OK/HEALTHY") return HttpResponse("OK/HEALTHY") diff --git a/theme/__init__.py b/src/pkmntrade_club/static/__init__.py similarity index 100% rename from theme/__init__.py rename to src/pkmntrade_club/static/__init__.py diff --git a/static/css/base.css b/src/pkmntrade_club/static/css/base.css similarity index 100% rename from static/css/base.css rename to src/pkmntrade_club/static/css/base.css diff --git a/static/css/card-multiselect.css b/src/pkmntrade_club/static/css/card-multiselect.css similarity index 100% rename from static/css/card-multiselect.css rename to src/pkmntrade_club/static/css/card-multiselect.css diff --git a/static/css/choices.min.css b/src/pkmntrade_club/static/css/choices.min.css similarity index 100% rename from static/css/choices.min.css rename to src/pkmntrade_club/static/css/choices.min.css diff --git a/static/css/hovercards.min.css b/src/pkmntrade_club/static/css/hovercards.min.css similarity index 100% rename from static/css/hovercards.min.css rename to src/pkmntrade_club/static/css/hovercards.min.css diff --git a/static/images/favicon.ico b/src/pkmntrade_club/static/images/favicon.ico similarity index 100% rename from static/images/favicon.ico rename to src/pkmntrade_club/static/images/favicon.ico diff --git a/static/js/alpinejs.collapse@3.14.8.min.js b/src/pkmntrade_club/static/js/alpinejs.collapse@3.14.8.min.js similarity index 100% rename from static/js/alpinejs.collapse@3.14.8.min.js rename to src/pkmntrade_club/static/js/alpinejs.collapse@3.14.8.min.js diff --git a/static/js/alpinejs@3.14.8.min.js b/src/pkmntrade_club/static/js/alpinejs@3.14.8.min.js similarity index 100% rename from static/js/alpinejs@3.14.8.min.js rename to src/pkmntrade_club/static/js/alpinejs@3.14.8.min.js diff --git a/static/js/base.js b/src/pkmntrade_club/static/js/base.js similarity index 100% rename from static/js/base.js rename to src/pkmntrade_club/static/js/base.js diff --git a/static/js/card-multiselect.js b/src/pkmntrade_club/static/js/card-multiselect.js similarity index 100% rename from static/js/card-multiselect.js rename to src/pkmntrade_club/static/js/card-multiselect.js diff --git a/static/js/choices.min.js b/src/pkmntrade_club/static/js/choices.min.js similarity index 100% rename from static/js/choices.min.js rename to src/pkmntrade_club/static/js/choices.min.js diff --git a/static/js/floating-ui_core@1.6.9.9.min.js b/src/pkmntrade_club/static/js/floating-ui_core@1.6.9.9.min.js similarity index 100% rename from static/js/floating-ui_core@1.6.9.9.min.js rename to src/pkmntrade_club/static/js/floating-ui_core@1.6.9.9.min.js diff --git a/static/js/floating-ui_dom@1.6.13.13.min.js b/src/pkmntrade_club/static/js/floating-ui_dom@1.6.13.13.min.js similarity index 100% rename from static/js/floating-ui_dom@1.6.13.13.min.js rename to src/pkmntrade_club/static/js/floating-ui_dom@1.6.13.13.min.js diff --git a/static/js/hovercards.min.js b/src/pkmntrade_club/static/js/hovercards.min.js similarity index 100% rename from static/js/hovercards.min.js rename to src/pkmntrade_club/static/js/hovercards.min.js diff --git a/static/js/tooltip.js b/src/pkmntrade_club/static/js/tooltip.js similarity index 100% rename from static/js/tooltip.js rename to src/pkmntrade_club/static/js/tooltip.js diff --git a/tests/utils/rarity.py b/src/pkmntrade_club/tests/utils/rarity.py similarity index 100% rename from tests/utils/rarity.py rename to src/pkmntrade_club/tests/utils/rarity.py diff --git a/trades/__init__.py b/src/pkmntrade_club/theme/__init__.py similarity index 100% rename from trades/__init__.py rename to src/pkmntrade_club/theme/__init__.py diff --git a/theme/apps.py b/src/pkmntrade_club/theme/apps.py similarity index 66% rename from theme/apps.py rename to src/pkmntrade_club/theme/apps.py index bec7464..71e85a3 100644 --- a/theme/apps.py +++ b/src/pkmntrade_club/theme/apps.py @@ -2,4 +2,4 @@ from django.apps import AppConfig class ThemeConfig(AppConfig): - name = 'theme' + name = 'pkmntrade_club.theme' diff --git a/theme/static_src/package-lock.json b/src/pkmntrade_club/theme/static_src/package-lock.json similarity index 100% rename from theme/static_src/package-lock.json rename to src/pkmntrade_club/theme/static_src/package-lock.json diff --git a/theme/static_src/package.json b/src/pkmntrade_club/theme/static_src/package.json similarity index 100% rename from theme/static_src/package.json rename to src/pkmntrade_club/theme/static_src/package.json diff --git a/theme/static_src/postcss.config.js b/src/pkmntrade_club/theme/static_src/postcss.config.js similarity index 100% rename from theme/static_src/postcss.config.js rename to src/pkmntrade_club/theme/static_src/postcss.config.js diff --git a/theme/static_src/src/styles.css b/src/pkmntrade_club/theme/static_src/src/styles.css similarity index 100% rename from theme/static_src/src/styles.css rename to src/pkmntrade_club/theme/static_src/src/styles.css diff --git a/theme/static_src/tailwind.config.js b/src/pkmntrade_club/theme/static_src/tailwind.config.js similarity index 100% rename from theme/static_src/tailwind.config.js rename to src/pkmntrade_club/theme/static_src/tailwind.config.js diff --git a/theme/templates/403_csrf.html b/src/pkmntrade_club/theme/templates/403_csrf.html similarity index 100% rename from theme/templates/403_csrf.html rename to src/pkmntrade_club/theme/templates/403_csrf.html diff --git a/theme/templates/404.html b/src/pkmntrade_club/theme/templates/404.html similarity index 100% rename from theme/templates/404.html rename to src/pkmntrade_club/theme/templates/404.html diff --git a/theme/templates/500.html b/src/pkmntrade_club/theme/templates/500.html similarity index 100% rename from theme/templates/500.html rename to src/pkmntrade_club/theme/templates/500.html diff --git a/theme/templates/_messages.html b/src/pkmntrade_club/theme/templates/_messages.html similarity index 100% rename from theme/templates/_messages.html rename to src/pkmntrade_club/theme/templates/_messages.html diff --git a/theme/templates/account/account_inactive.html b/src/pkmntrade_club/theme/templates/account/account_inactive.html similarity index 100% rename from theme/templates/account/account_inactive.html rename to src/pkmntrade_club/theme/templates/account/account_inactive.html diff --git a/theme/templates/account/confirm_email_verification_code.html b/src/pkmntrade_club/theme/templates/account/confirm_email_verification_code.html similarity index 100% rename from theme/templates/account/confirm_email_verification_code.html rename to src/pkmntrade_club/theme/templates/account/confirm_email_verification_code.html diff --git a/theme/templates/account/confirm_login_code.html b/src/pkmntrade_club/theme/templates/account/confirm_login_code.html similarity index 100% rename from theme/templates/account/confirm_login_code.html rename to src/pkmntrade_club/theme/templates/account/confirm_login_code.html diff --git a/theme/templates/account/confirm_password_reset_code.html b/src/pkmntrade_club/theme/templates/account/confirm_password_reset_code.html similarity index 100% rename from theme/templates/account/confirm_password_reset_code.html rename to src/pkmntrade_club/theme/templates/account/confirm_password_reset_code.html diff --git a/theme/templates/account/confirm_phone_verification_code.html b/src/pkmntrade_club/theme/templates/account/confirm_phone_verification_code.html similarity index 100% rename from theme/templates/account/confirm_phone_verification_code.html rename to src/pkmntrade_club/theme/templates/account/confirm_phone_verification_code.html diff --git a/theme/templates/account/dashboard.html b/src/pkmntrade_club/theme/templates/account/dashboard.html similarity index 100% rename from theme/templates/account/dashboard.html rename to src/pkmntrade_club/theme/templates/account/dashboard.html diff --git a/theme/templates/account/email.html b/src/pkmntrade_club/theme/templates/account/email.html similarity index 100% rename from theme/templates/account/email.html rename to src/pkmntrade_club/theme/templates/account/email.html diff --git a/theme/templates/account/email/account_already_exists_message.txt b/src/pkmntrade_club/theme/templates/account/email/account_already_exists_message.txt similarity index 100% rename from theme/templates/account/email/account_already_exists_message.txt rename to src/pkmntrade_club/theme/templates/account/email/account_already_exists_message.txt diff --git a/theme/templates/account/email/account_already_exists_subject.txt b/src/pkmntrade_club/theme/templates/account/email/account_already_exists_subject.txt similarity index 100% rename from theme/templates/account/email/account_already_exists_subject.txt rename to src/pkmntrade_club/theme/templates/account/email/account_already_exists_subject.txt diff --git a/theme/templates/account/email/base_message.txt b/src/pkmntrade_club/theme/templates/account/email/base_message.txt similarity index 100% rename from theme/templates/account/email/base_message.txt rename to src/pkmntrade_club/theme/templates/account/email/base_message.txt diff --git a/theme/templates/account/email/base_notification.txt b/src/pkmntrade_club/theme/templates/account/email/base_notification.txt similarity index 100% rename from theme/templates/account/email/base_notification.txt rename to src/pkmntrade_club/theme/templates/account/email/base_notification.txt diff --git a/theme/templates/account/email/email_changed_message.txt b/src/pkmntrade_club/theme/templates/account/email/email_changed_message.txt similarity index 100% rename from theme/templates/account/email/email_changed_message.txt rename to src/pkmntrade_club/theme/templates/account/email/email_changed_message.txt diff --git a/theme/templates/account/email/email_changed_subject.txt b/src/pkmntrade_club/theme/templates/account/email/email_changed_subject.txt similarity index 100% rename from theme/templates/account/email/email_changed_subject.txt rename to src/pkmntrade_club/theme/templates/account/email/email_changed_subject.txt diff --git a/theme/templates/account/email/email_confirm_message.txt b/src/pkmntrade_club/theme/templates/account/email/email_confirm_message.txt similarity index 100% rename from theme/templates/account/email/email_confirm_message.txt rename to src/pkmntrade_club/theme/templates/account/email/email_confirm_message.txt diff --git a/theme/templates/account/email/email_confirm_subject.txt b/src/pkmntrade_club/theme/templates/account/email/email_confirm_subject.txt similarity index 100% rename from theme/templates/account/email/email_confirm_subject.txt rename to src/pkmntrade_club/theme/templates/account/email/email_confirm_subject.txt diff --git a/theme/templates/account/email/email_confirmation_message.txt b/src/pkmntrade_club/theme/templates/account/email/email_confirmation_message.txt similarity index 100% rename from theme/templates/account/email/email_confirmation_message.txt rename to src/pkmntrade_club/theme/templates/account/email/email_confirmation_message.txt diff --git a/theme/templates/account/email/email_confirmation_signup_message.txt b/src/pkmntrade_club/theme/templates/account/email/email_confirmation_signup_message.txt similarity index 100% rename from theme/templates/account/email/email_confirmation_signup_message.txt rename to src/pkmntrade_club/theme/templates/account/email/email_confirmation_signup_message.txt diff --git a/theme/templates/account/email/email_confirmation_signup_subject.txt b/src/pkmntrade_club/theme/templates/account/email/email_confirmation_signup_subject.txt similarity index 100% rename from theme/templates/account/email/email_confirmation_signup_subject.txt rename to src/pkmntrade_club/theme/templates/account/email/email_confirmation_signup_subject.txt diff --git a/theme/templates/account/email/email_confirmation_subject.txt b/src/pkmntrade_club/theme/templates/account/email/email_confirmation_subject.txt similarity index 100% rename from theme/templates/account/email/email_confirmation_subject.txt rename to src/pkmntrade_club/theme/templates/account/email/email_confirmation_subject.txt diff --git a/theme/templates/account/email/email_deleted_message.txt b/src/pkmntrade_club/theme/templates/account/email/email_deleted_message.txt similarity index 100% rename from theme/templates/account/email/email_deleted_message.txt rename to src/pkmntrade_club/theme/templates/account/email/email_deleted_message.txt diff --git a/theme/templates/account/email/email_deleted_subject.txt b/src/pkmntrade_club/theme/templates/account/email/email_deleted_subject.txt similarity index 100% rename from theme/templates/account/email/email_deleted_subject.txt rename to src/pkmntrade_club/theme/templates/account/email/email_deleted_subject.txt diff --git a/theme/templates/account/email/login_code_message.txt b/src/pkmntrade_club/theme/templates/account/email/login_code_message.txt similarity index 100% rename from theme/templates/account/email/login_code_message.txt rename to src/pkmntrade_club/theme/templates/account/email/login_code_message.txt diff --git a/theme/templates/account/email/login_code_subject.txt b/src/pkmntrade_club/theme/templates/account/email/login_code_subject.txt similarity index 100% rename from theme/templates/account/email/login_code_subject.txt rename to src/pkmntrade_club/theme/templates/account/email/login_code_subject.txt diff --git a/theme/templates/account/email/password_changed_message.txt b/src/pkmntrade_club/theme/templates/account/email/password_changed_message.txt similarity index 100% rename from theme/templates/account/email/password_changed_message.txt rename to src/pkmntrade_club/theme/templates/account/email/password_changed_message.txt diff --git a/theme/templates/account/email/password_changed_subject.txt b/src/pkmntrade_club/theme/templates/account/email/password_changed_subject.txt similarity index 100% rename from theme/templates/account/email/password_changed_subject.txt rename to src/pkmntrade_club/theme/templates/account/email/password_changed_subject.txt diff --git a/theme/templates/account/email/password_reset_code_message.txt b/src/pkmntrade_club/theme/templates/account/email/password_reset_code_message.txt similarity index 100% rename from theme/templates/account/email/password_reset_code_message.txt rename to src/pkmntrade_club/theme/templates/account/email/password_reset_code_message.txt diff --git a/theme/templates/account/email/password_reset_code_subject.txt b/src/pkmntrade_club/theme/templates/account/email/password_reset_code_subject.txt similarity index 100% rename from theme/templates/account/email/password_reset_code_subject.txt rename to src/pkmntrade_club/theme/templates/account/email/password_reset_code_subject.txt diff --git a/theme/templates/account/email/password_reset_key_message.txt b/src/pkmntrade_club/theme/templates/account/email/password_reset_key_message.txt similarity index 100% rename from theme/templates/account/email/password_reset_key_message.txt rename to src/pkmntrade_club/theme/templates/account/email/password_reset_key_message.txt diff --git a/theme/templates/account/email/password_reset_key_subject.txt b/src/pkmntrade_club/theme/templates/account/email/password_reset_key_subject.txt similarity index 100% rename from theme/templates/account/email/password_reset_key_subject.txt rename to src/pkmntrade_club/theme/templates/account/email/password_reset_key_subject.txt diff --git a/theme/templates/account/email/password_reset_message.txt b/src/pkmntrade_club/theme/templates/account/email/password_reset_message.txt similarity index 100% rename from theme/templates/account/email/password_reset_message.txt rename to src/pkmntrade_club/theme/templates/account/email/password_reset_message.txt diff --git a/theme/templates/account/email/password_reset_subject.txt b/src/pkmntrade_club/theme/templates/account/email/password_reset_subject.txt similarity index 100% rename from theme/templates/account/email/password_reset_subject.txt rename to src/pkmntrade_club/theme/templates/account/email/password_reset_subject.txt diff --git a/theme/templates/account/email/password_set_message.txt b/src/pkmntrade_club/theme/templates/account/email/password_set_message.txt similarity index 100% rename from theme/templates/account/email/password_set_message.txt rename to src/pkmntrade_club/theme/templates/account/email/password_set_message.txt diff --git a/theme/templates/account/email/password_set_subject.txt b/src/pkmntrade_club/theme/templates/account/email/password_set_subject.txt similarity index 100% rename from theme/templates/account/email/password_set_subject.txt rename to src/pkmntrade_club/theme/templates/account/email/password_set_subject.txt diff --git a/theme/templates/account/email/unknown_account_message.txt b/src/pkmntrade_club/theme/templates/account/email/unknown_account_message.txt similarity index 100% rename from theme/templates/account/email/unknown_account_message.txt rename to src/pkmntrade_club/theme/templates/account/email/unknown_account_message.txt diff --git a/theme/templates/account/email/unknown_account_subject.txt b/src/pkmntrade_club/theme/templates/account/email/unknown_account_subject.txt similarity index 100% rename from theme/templates/account/email/unknown_account_subject.txt rename to src/pkmntrade_club/theme/templates/account/email/unknown_account_subject.txt diff --git a/theme/templates/account/email_change.html b/src/pkmntrade_club/theme/templates/account/email_change.html similarity index 100% rename from theme/templates/account/email_change.html rename to src/pkmntrade_club/theme/templates/account/email_change.html diff --git a/theme/templates/account/email_confirm.html b/src/pkmntrade_club/theme/templates/account/email_confirm.html similarity index 100% rename from theme/templates/account/email_confirm.html rename to src/pkmntrade_club/theme/templates/account/email_confirm.html diff --git a/theme/templates/account/login.html b/src/pkmntrade_club/theme/templates/account/login.html similarity index 100% rename from theme/templates/account/login.html rename to src/pkmntrade_club/theme/templates/account/login.html diff --git a/theme/templates/account/logout.html b/src/pkmntrade_club/theme/templates/account/logout.html similarity index 100% rename from theme/templates/account/logout.html rename to src/pkmntrade_club/theme/templates/account/logout.html diff --git a/theme/templates/account/password_change.html b/src/pkmntrade_club/theme/templates/account/password_change.html similarity index 100% rename from theme/templates/account/password_change.html rename to src/pkmntrade_club/theme/templates/account/password_change.html diff --git a/theme/templates/account/password_reset.html b/src/pkmntrade_club/theme/templates/account/password_reset.html similarity index 100% rename from theme/templates/account/password_reset.html rename to src/pkmntrade_club/theme/templates/account/password_reset.html diff --git a/theme/templates/account/password_reset_done.html b/src/pkmntrade_club/theme/templates/account/password_reset_done.html similarity index 100% rename from theme/templates/account/password_reset_done.html rename to src/pkmntrade_club/theme/templates/account/password_reset_done.html diff --git a/theme/templates/account/password_reset_from_key.html b/src/pkmntrade_club/theme/templates/account/password_reset_from_key.html similarity index 100% rename from theme/templates/account/password_reset_from_key.html rename to src/pkmntrade_club/theme/templates/account/password_reset_from_key.html diff --git a/theme/templates/account/password_reset_from_key_done.html b/src/pkmntrade_club/theme/templates/account/password_reset_from_key_done.html similarity index 100% rename from theme/templates/account/password_reset_from_key_done.html rename to src/pkmntrade_club/theme/templates/account/password_reset_from_key_done.html diff --git a/theme/templates/account/reauthenticate.html b/src/pkmntrade_club/theme/templates/account/reauthenticate.html similarity index 100% rename from theme/templates/account/reauthenticate.html rename to src/pkmntrade_club/theme/templates/account/reauthenticate.html diff --git a/theme/templates/account/request_login_code.html b/src/pkmntrade_club/theme/templates/account/request_login_code.html similarity index 100% rename from theme/templates/account/request_login_code.html rename to src/pkmntrade_club/theme/templates/account/request_login_code.html diff --git a/theme/templates/account/signup.html b/src/pkmntrade_club/theme/templates/account/signup.html similarity index 100% rename from theme/templates/account/signup.html rename to src/pkmntrade_club/theme/templates/account/signup.html diff --git a/theme/templates/account/signup_by_passkey.html b/src/pkmntrade_club/theme/templates/account/signup_by_passkey.html similarity index 100% rename from theme/templates/account/signup_by_passkey.html rename to src/pkmntrade_club/theme/templates/account/signup_by_passkey.html diff --git a/theme/templates/account/signup_closed.html b/src/pkmntrade_club/theme/templates/account/signup_closed.html similarity index 100% rename from theme/templates/account/signup_closed.html rename to src/pkmntrade_club/theme/templates/account/signup_closed.html diff --git a/theme/templates/account/verification_sent.html b/src/pkmntrade_club/theme/templates/account/verification_sent.html similarity index 100% rename from theme/templates/account/verification_sent.html rename to src/pkmntrade_club/theme/templates/account/verification_sent.html diff --git a/theme/templates/account/verified_email_required.html b/src/pkmntrade_club/theme/templates/account/verified_email_required.html similarity index 100% rename from theme/templates/account/verified_email_required.html rename to src/pkmntrade_club/theme/templates/account/verified_email_required.html diff --git a/theme/templates/base.html b/src/pkmntrade_club/theme/templates/base.html similarity index 100% rename from theme/templates/base.html rename to src/pkmntrade_club/theme/templates/base.html diff --git a/theme/templates/cards/_card_list.html b/src/pkmntrade_club/theme/templates/cards/_card_list.html similarity index 100% rename from theme/templates/cards/_card_list.html rename to src/pkmntrade_club/theme/templates/cards/_card_list.html diff --git a/theme/templates/cards/card_detail.html b/src/pkmntrade_club/theme/templates/cards/card_detail.html similarity index 100% rename from theme/templates/cards/card_detail.html rename to src/pkmntrade_club/theme/templates/cards/card_detail.html diff --git a/theme/templates/cards/card_list.html b/src/pkmntrade_club/theme/templates/cards/card_list.html similarity index 100% rename from theme/templates/cards/card_list.html rename to src/pkmntrade_club/theme/templates/cards/card_list.html diff --git a/theme/templates/email/common/footer.txt b/src/pkmntrade_club/theme/templates/email/common/footer.txt similarity index 100% rename from theme/templates/email/common/footer.txt rename to src/pkmntrade_club/theme/templates/email/common/footer.txt diff --git a/theme/templates/email/common/header.txt b/src/pkmntrade_club/theme/templates/email/common/header.txt similarity index 100% rename from theme/templates/email/common/header.txt rename to src/pkmntrade_club/theme/templates/email/common/header.txt diff --git a/theme/templates/email/common/subject.txt b/src/pkmntrade_club/theme/templates/email/common/subject.txt similarity index 100% rename from theme/templates/email/common/subject.txt rename to src/pkmntrade_club/theme/templates/email/common/subject.txt diff --git a/theme/templates/email/trades/trade_update_accepted.txt b/src/pkmntrade_club/theme/templates/email/trades/trade_update_accepted.txt similarity index 100% rename from theme/templates/email/trades/trade_update_accepted.txt rename to src/pkmntrade_club/theme/templates/email/trades/trade_update_accepted.txt diff --git a/theme/templates/email/trades/trade_update_accepted_subject.txt b/src/pkmntrade_club/theme/templates/email/trades/trade_update_accepted_subject.txt similarity index 100% rename from theme/templates/email/trades/trade_update_accepted_subject.txt rename to src/pkmntrade_club/theme/templates/email/trades/trade_update_accepted_subject.txt diff --git a/theme/templates/email/trades/trade_update_received.txt b/src/pkmntrade_club/theme/templates/email/trades/trade_update_received.txt similarity index 100% rename from theme/templates/email/trades/trade_update_received.txt rename to src/pkmntrade_club/theme/templates/email/trades/trade_update_received.txt diff --git a/theme/templates/email/trades/trade_update_received_subject.txt b/src/pkmntrade_club/theme/templates/email/trades/trade_update_received_subject.txt similarity index 100% rename from theme/templates/email/trades/trade_update_received_subject.txt rename to src/pkmntrade_club/theme/templates/email/trades/trade_update_received_subject.txt diff --git a/theme/templates/email/trades/trade_update_rejected_by_acceptor.txt b/src/pkmntrade_club/theme/templates/email/trades/trade_update_rejected_by_acceptor.txt similarity index 100% rename from theme/templates/email/trades/trade_update_rejected_by_acceptor.txt rename to src/pkmntrade_club/theme/templates/email/trades/trade_update_rejected_by_acceptor.txt diff --git a/theme/templates/email/trades/trade_update_rejected_by_acceptor_subject.txt b/src/pkmntrade_club/theme/templates/email/trades/trade_update_rejected_by_acceptor_subject.txt similarity index 100% rename from theme/templates/email/trades/trade_update_rejected_by_acceptor_subject.txt rename to src/pkmntrade_club/theme/templates/email/trades/trade_update_rejected_by_acceptor_subject.txt diff --git a/theme/templates/email/trades/trade_update_rejected_by_initiator.txt b/src/pkmntrade_club/theme/templates/email/trades/trade_update_rejected_by_initiator.txt similarity index 100% rename from theme/templates/email/trades/trade_update_rejected_by_initiator.txt rename to src/pkmntrade_club/theme/templates/email/trades/trade_update_rejected_by_initiator.txt diff --git a/theme/templates/email/trades/trade_update_rejected_by_initiator_subject.txt b/src/pkmntrade_club/theme/templates/email/trades/trade_update_rejected_by_initiator_subject.txt similarity index 100% rename from theme/templates/email/trades/trade_update_rejected_by_initiator_subject.txt rename to src/pkmntrade_club/theme/templates/email/trades/trade_update_rejected_by_initiator_subject.txt diff --git a/theme/templates/email/trades/trade_update_sent.txt b/src/pkmntrade_club/theme/templates/email/trades/trade_update_sent.txt similarity index 100% rename from theme/templates/email/trades/trade_update_sent.txt rename to src/pkmntrade_club/theme/templates/email/trades/trade_update_sent.txt diff --git a/theme/templates/email/trades/trade_update_sent_subject.txt b/src/pkmntrade_club/theme/templates/email/trades/trade_update_sent_subject.txt similarity index 100% rename from theme/templates/email/trades/trade_update_sent_subject.txt rename to src/pkmntrade_club/theme/templates/email/trades/trade_update_sent_subject.txt diff --git a/theme/templates/email/trades/trade_update_thanked_by_acceptor.txt b/src/pkmntrade_club/theme/templates/email/trades/trade_update_thanked_by_acceptor.txt similarity index 100% rename from theme/templates/email/trades/trade_update_thanked_by_acceptor.txt rename to src/pkmntrade_club/theme/templates/email/trades/trade_update_thanked_by_acceptor.txt diff --git a/theme/templates/email/trades/trade_update_thanked_by_acceptor_subject.txt b/src/pkmntrade_club/theme/templates/email/trades/trade_update_thanked_by_acceptor_subject.txt similarity index 100% rename from theme/templates/email/trades/trade_update_thanked_by_acceptor_subject.txt rename to src/pkmntrade_club/theme/templates/email/trades/trade_update_thanked_by_acceptor_subject.txt diff --git a/theme/templates/email/trades/trade_update_thanked_by_both.txt b/src/pkmntrade_club/theme/templates/email/trades/trade_update_thanked_by_both.txt similarity index 100% rename from theme/templates/email/trades/trade_update_thanked_by_both.txt rename to src/pkmntrade_club/theme/templates/email/trades/trade_update_thanked_by_both.txt diff --git a/theme/templates/email/trades/trade_update_thanked_by_both_subject.txt b/src/pkmntrade_club/theme/templates/email/trades/trade_update_thanked_by_both_subject.txt similarity index 100% rename from theme/templates/email/trades/trade_update_thanked_by_both_subject.txt rename to src/pkmntrade_club/theme/templates/email/trades/trade_update_thanked_by_both_subject.txt diff --git a/theme/templates/email/trades/trade_update_thanked_by_initiator.txt b/src/pkmntrade_club/theme/templates/email/trades/trade_update_thanked_by_initiator.txt similarity index 100% rename from theme/templates/email/trades/trade_update_thanked_by_initiator.txt rename to src/pkmntrade_club/theme/templates/email/trades/trade_update_thanked_by_initiator.txt diff --git a/theme/templates/email/trades/trade_update_thanked_by_initiator_subject.txt b/src/pkmntrade_club/theme/templates/email/trades/trade_update_thanked_by_initiator_subject.txt similarity index 100% rename from theme/templates/email/trades/trade_update_thanked_by_initiator_subject.txt rename to src/pkmntrade_club/theme/templates/email/trades/trade_update_thanked_by_initiator_subject.txt diff --git a/theme/templates/friend_codes/add_friend_code.html b/src/pkmntrade_club/theme/templates/friend_codes/add_friend_code.html similarity index 100% rename from theme/templates/friend_codes/add_friend_code.html rename to src/pkmntrade_club/theme/templates/friend_codes/add_friend_code.html diff --git a/theme/templates/friend_codes/confirm_delete_friend_code.html b/src/pkmntrade_club/theme/templates/friend_codes/confirm_delete_friend_code.html similarity index 100% rename from theme/templates/friend_codes/confirm_delete_friend_code.html rename to src/pkmntrade_club/theme/templates/friend_codes/confirm_delete_friend_code.html diff --git a/theme/templates/friend_codes/edit_friend_code.html b/src/pkmntrade_club/theme/templates/friend_codes/edit_friend_code.html similarity index 100% rename from theme/templates/friend_codes/edit_friend_code.html rename to src/pkmntrade_club/theme/templates/friend_codes/edit_friend_code.html diff --git a/theme/templates/home/_card_list.html b/src/pkmntrade_club/theme/templates/home/_card_list.html similarity index 100% rename from theme/templates/home/_card_list.html rename to src/pkmntrade_club/theme/templates/home/_card_list.html diff --git a/theme/templates/home/home.html b/src/pkmntrade_club/theme/templates/home/home.html similarity index 100% rename from theme/templates/home/home.html rename to src/pkmntrade_club/theme/templates/home/home.html diff --git a/theme/templates/tailwind/field.html b/src/pkmntrade_club/theme/templates/tailwind/field.html similarity index 100% rename from theme/templates/tailwind/field.html rename to src/pkmntrade_club/theme/templates/tailwind/field.html diff --git a/theme/templates/tailwind/layout/help_text.html b/src/pkmntrade_club/theme/templates/tailwind/layout/help_text.html similarity index 100% rename from theme/templates/tailwind/layout/help_text.html rename to src/pkmntrade_club/theme/templates/tailwind/layout/help_text.html diff --git a/theme/templates/trades/_friend_code_select.html b/src/pkmntrade_club/theme/templates/trades/_friend_code_select.html similarity index 100% rename from theme/templates/trades/_friend_code_select.html rename to src/pkmntrade_club/theme/templates/trades/_friend_code_select.html diff --git a/theme/templates/trades/_search_results.html b/src/pkmntrade_club/theme/templates/trades/_search_results.html similarity index 100% rename from theme/templates/trades/_search_results.html rename to src/pkmntrade_club/theme/templates/trades/_search_results.html diff --git a/theme/templates/trades/_trade_offer_list.html b/src/pkmntrade_club/theme/templates/trades/_trade_offer_list.html similarity index 100% rename from theme/templates/trades/_trade_offer_list.html rename to src/pkmntrade_club/theme/templates/trades/_trade_offer_list.html diff --git a/theme/templates/trades/trade_acceptance_create.html b/src/pkmntrade_club/theme/templates/trades/trade_acceptance_create.html similarity index 100% rename from theme/templates/trades/trade_acceptance_create.html rename to src/pkmntrade_club/theme/templates/trades/trade_acceptance_create.html diff --git a/theme/templates/trades/trade_acceptance_update.html b/src/pkmntrade_club/theme/templates/trades/trade_acceptance_update.html similarity index 100% rename from theme/templates/trades/trade_acceptance_update.html rename to src/pkmntrade_club/theme/templates/trades/trade_acceptance_update.html diff --git a/theme/templates/trades/trade_offer_all_list.html b/src/pkmntrade_club/theme/templates/trades/trade_offer_all_list.html similarity index 100% rename from theme/templates/trades/trade_offer_all_list.html rename to src/pkmntrade_club/theme/templates/trades/trade_offer_all_list.html diff --git a/theme/templates/trades/trade_offer_confirm_create.html b/src/pkmntrade_club/theme/templates/trades/trade_offer_confirm_create.html similarity index 100% rename from theme/templates/trades/trade_offer_confirm_create.html rename to src/pkmntrade_club/theme/templates/trades/trade_offer_confirm_create.html diff --git a/theme/templates/trades/trade_offer_create.html b/src/pkmntrade_club/theme/templates/trades/trade_offer_create.html similarity index 100% rename from theme/templates/trades/trade_offer_create.html rename to src/pkmntrade_club/theme/templates/trades/trade_offer_create.html diff --git a/theme/templates/trades/trade_offer_delete.html b/src/pkmntrade_club/theme/templates/trades/trade_offer_delete.html similarity index 100% rename from theme/templates/trades/trade_offer_delete.html rename to src/pkmntrade_club/theme/templates/trades/trade_offer_delete.html diff --git a/theme/templates/trades/trade_offer_detail.html b/src/pkmntrade_club/theme/templates/trades/trade_offer_detail.html similarity index 100% rename from theme/templates/trades/trade_offer_detail.html rename to src/pkmntrade_club/theme/templates/trades/trade_offer_detail.html diff --git a/theme/templates/trades/trade_offer_search.html b/src/pkmntrade_club/theme/templates/trades/trade_offer_search.html similarity index 100% rename from theme/templates/trades/trade_offer_search.html rename to src/pkmntrade_club/theme/templates/trades/trade_offer_search.html diff --git a/theme/templates/trades/trade_offer_update.html b/src/pkmntrade_club/theme/templates/trades/trade_offer_update.html similarity index 100% rename from theme/templates/trades/trade_offer_update.html rename to src/pkmntrade_club/theme/templates/trades/trade_offer_update.html diff --git a/theme/templates/widgets/button_radio_select.html b/src/pkmntrade_club/theme/templates/widgets/button_radio_select.html similarity index 100% rename from theme/templates/widgets/button_radio_select.html rename to src/pkmntrade_club/theme/templates/widgets/button_radio_select.html diff --git a/theme/templatetags/_card_multiselect_options.html b/src/pkmntrade_club/theme/templatetags/_card_multiselect_options.html similarity index 100% rename from theme/templatetags/_card_multiselect_options.html rename to src/pkmntrade_club/theme/templatetags/_card_multiselect_options.html diff --git a/theme/templatetags/card_badge.html b/src/pkmntrade_club/theme/templatetags/card_badge.html similarity index 100% rename from theme/templatetags/card_badge.html rename to src/pkmntrade_club/theme/templatetags/card_badge.html diff --git a/theme/templatetags/card_multiselect.html b/src/pkmntrade_club/theme/templatetags/card_multiselect.html similarity index 100% rename from theme/templatetags/card_multiselect.html rename to src/pkmntrade_club/theme/templatetags/card_multiselect.html diff --git a/theme/templatetags/pagination_controls.html b/src/pkmntrade_club/theme/templatetags/pagination_controls.html similarity index 100% rename from theme/templatetags/pagination_controls.html rename to src/pkmntrade_club/theme/templatetags/pagination_controls.html diff --git a/theme/templatetags/trade_acceptance.html b/src/pkmntrade_club/theme/templatetags/trade_acceptance.html similarity index 100% rename from theme/templatetags/trade_acceptance.html rename to src/pkmntrade_club/theme/templatetags/trade_acceptance.html diff --git a/theme/templatetags/trade_offer.html b/src/pkmntrade_club/theme/templatetags/trade_offer.html similarity index 100% rename from theme/templatetags/trade_offer.html rename to src/pkmntrade_club/theme/templatetags/trade_offer.html diff --git a/theme/templatetags/trade_offer_old.html b/src/pkmntrade_club/theme/templatetags/trade_offer_old.html similarity index 100% rename from theme/templatetags/trade_offer_old.html rename to src/pkmntrade_club/theme/templatetags/trade_offer_old.html diff --git a/theme/templatetags/trade_offer_png.html b/src/pkmntrade_club/theme/templatetags/trade_offer_png.html similarity index 100% rename from theme/templatetags/trade_offer_png.html rename to src/pkmntrade_club/theme/templatetags/trade_offer_png.html diff --git a/trades/migrations/__init__.py b/src/pkmntrade_club/trades/__init__.py similarity index 100% rename from trades/migrations/__init__.py rename to src/pkmntrade_club/trades/__init__.py diff --git a/trades/admin.py b/src/pkmntrade_club/trades/admin.py similarity index 100% rename from trades/admin.py rename to src/pkmntrade_club/trades/admin.py diff --git a/trades/apps.py b/src/pkmntrade_club/trades/apps.py similarity index 66% rename from trades/apps.py rename to src/pkmntrade_club/trades/apps.py index 1418526..a4c30a3 100644 --- a/trades/apps.py +++ b/src/pkmntrade_club/trades/apps.py @@ -2,8 +2,8 @@ from django.apps import AppConfig class TradesConfig(AppConfig): - name = "trades" + name = "pkmntrade_club.trades" def ready(self): # Implicitly connect signal handlers decorated with @receiver. - import trades.signals + import pkmntrade_club.trades.signals diff --git a/trades/forms.py b/src/pkmntrade_club/trades/forms.py similarity index 97% rename from trades/forms.py rename to src/pkmntrade_club/trades/forms.py index 146a0a5..bd8fb63 100644 --- a/trades/forms.py +++ b/src/pkmntrade_club/trades/forms.py @@ -1,10 +1,10 @@ from django import forms from django.core.exceptions import ValidationError from .models import TradeOffer, TradeAcceptance -from accounts.models import FriendCode -from cards.models import Card +from pkmntrade_club.accounts.models import FriendCode +from pkmntrade_club.cards.models import Card from django.forms import ModelForm -from trades.models import TradeOfferHaveCard, TradeOfferWantCard +from pkmntrade_club.trades.models import TradeOfferHaveCard, TradeOfferWantCard class NoValidationMultipleChoiceField(forms.MultipleChoiceField): def validate(self, value): diff --git a/trades/migrations/0001_initial.py b/src/pkmntrade_club/trades/migrations/0001_initial.py similarity index 99% rename from trades/migrations/0001_initial.py rename to src/pkmntrade_club/trades/migrations/0001_initial.py index 2402f86..9e4f4c0 100644 --- a/trades/migrations/0001_initial.py +++ b/src/pkmntrade_club/trades/migrations/0001_initial.py @@ -1,4 +1,4 @@ -# Generated by Django 5.1 on 2025-05-09 01:49 +# Generated by Django 5.1 on 2025-05-10 01:22 import django.db.models.deletion from django.db import migrations, models diff --git a/trades/templatetags/__init__.py b/src/pkmntrade_club/trades/migrations/__init__.py similarity index 100% rename from trades/templatetags/__init__.py rename to src/pkmntrade_club/trades/migrations/__init__.py diff --git a/trades/migrations/max_migration.txt b/src/pkmntrade_club/trades/migrations/max_migration.txt similarity index 100% rename from trades/migrations/max_migration.txt rename to src/pkmntrade_club/trades/migrations/max_migration.txt diff --git a/trades/mixins.py b/src/pkmntrade_club/trades/mixins.py similarity index 97% rename from trades/mixins.py rename to src/pkmntrade_club/trades/mixins.py index afd4fc0..36d4272 100644 --- a/trades/mixins.py +++ b/src/pkmntrade_club/trades/mixins.py @@ -1,4 +1,4 @@ -from cards.models import Card +from pkmntrade_club.cards.models import Card from django.core.exceptions import PermissionDenied class TradeOfferContextMixin: diff --git a/trades/models.py b/src/pkmntrade_club/trades/models.py similarity index 99% rename from trades/models.py rename to src/pkmntrade_club/trades/models.py index 542e3c5..8690113 100644 --- a/trades/models.py +++ b/src/pkmntrade_club/trades/models.py @@ -2,8 +2,8 @@ from django.db import models from django.core.exceptions import ValidationError from django.db.models import Q, Count, Prefetch, F, Sum, Max import hashlib -from cards.models import Card -from accounts.models import FriendCode +from pkmntrade_club.cards.models import Card +from pkmntrade_club.accounts.models import FriendCode from datetime import timedelta from django.utils import timezone import uuid diff --git a/trades/signals.py b/src/pkmntrade_club/trades/signals.py similarity index 98% rename from trades/signals.py rename to src/pkmntrade_club/trades/signals.py index 76168cb..37caddb 100644 --- a/trades/signals.py +++ b/src/pkmntrade_club/trades/signals.py @@ -1,9 +1,9 @@ from django.db.models.signals import post_save, post_delete, pre_save from django.dispatch import receiver from django.db.models import F -from trades.models import TradeOfferHaveCard, TradeOfferWantCard, TradeAcceptance, TradeOffer +from pkmntrade_club.trades.models import TradeOfferHaveCard, TradeOfferWantCard, TradeAcceptance, TradeOffer from django.db import transaction -from accounts.models import CustomUser +from pkmntrade_club.accounts.models import CustomUser from datetime import timedelta from django.utils import timezone import uuid diff --git a/src/pkmntrade_club/trades/templatetags/__init__.py b/src/pkmntrade_club/trades/templatetags/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/trades/templatetags/trade_offer_tags.py b/src/pkmntrade_club/trades/templatetags/trade_offer_tags.py similarity index 98% rename from trades/templatetags/trade_offer_tags.py rename to src/pkmntrade_club/trades/templatetags/trade_offer_tags.py index e7ea7d6..673d25f 100644 --- a/trades/templatetags/trade_offer_tags.py +++ b/src/pkmntrade_club/trades/templatetags/trade_offer_tags.py @@ -1,6 +1,6 @@ from django import template from math import ceil -from trades.models import TradeAcceptance +from pkmntrade_club.trades.models import TradeAcceptance register = template.Library() @register.inclusion_tag('templatetags/trade_offer.html', takes_context=True) diff --git a/trades/tests.py b/src/pkmntrade_club/trades/tests.py similarity index 99% rename from trades/tests.py rename to src/pkmntrade_club/trades/tests.py index 4d5ece3..c188c16 100644 --- a/trades/tests.py +++ b/src/pkmntrade_club/trades/tests.py @@ -4,15 +4,15 @@ from django.contrib.auth import get_user_model from django.core.exceptions import ValidationError from django.http import QueryDict -from accounts.models import FriendCode -from cards.models import Card -from trades.models import ( +from pkmntrade_club.accounts.models import FriendCode +from pkmntrade_club.cards.models import Card +from pkmntrade_club.trades.models import ( TradeOffer, TradeOfferHaveCard, TradeOfferWantCard, TradeAcceptance, ) -from trades.forms import ( +from pkmntrade_club.trades.forms import ( TradeOfferCreateForm, TradeAcceptanceCreateForm, TradeOfferAcceptForm, @@ -406,7 +406,7 @@ class TradeViewsTest(TestCase): delete_url = reverse("trade_offer_delete", kwargs={"pk": trade_offer_with_acceptance.pk}) # --- Patch the view's get_object() method to return our trade offer --- - from trades.views import TradeOfferDeleteView + from pkmntrade_club.trades.views import TradeOfferDeleteView orig_get_object = TradeOfferDeleteView.get_object TradeOfferDeleteView.get_object = lambda self: trade_offer_with_acceptance diff --git a/trades/urls.py b/src/pkmntrade_club/trades/urls.py similarity index 100% rename from trades/urls.py rename to src/pkmntrade_club/trades/urls.py diff --git a/trades/views.py b/src/pkmntrade_club/trades/views.py similarity index 98% rename from trades/views.py rename to src/pkmntrade_club/trades/views.py index 8d0fa5d..8a25d45 100644 --- a/trades/views.py +++ b/src/pkmntrade_club/trades/views.py @@ -12,11 +12,11 @@ from meta.views import Meta from .models import TradeOffer, TradeAcceptance from .forms import (TradeAcceptanceCreateForm, TradeOfferCreateForm, TradeAcceptanceTransitionForm) from django.template.loader import render_to_string -from trades.templatetags.trade_offer_tags import render_trade_offer_png +from pkmntrade_club.trades.templatetags.trade_offer_tags import render_trade_offer_png from playwright.sync_api import sync_playwright from django.conf import settings from .mixins import FriendCodeRequiredMixin -from common.mixins import ReusablePaginationMixin +from pkmntrade_club.common.mixins import ReusablePaginationMixin class TradeOfferCreateView(LoginRequiredMixin, CreateView): http_method_names = ['get'] # restricts this view to GET only @@ -41,7 +41,7 @@ class TradeOfferCreateView(LoginRequiredMixin, CreateView): def get_context_data(self, **kwargs): context = super().get_context_data(**kwargs) - from cards.models import Card + from pkmntrade_club.cards.models import Card # Ensure available_cards is a proper QuerySet context["cards"] = Card.objects.filter(rarity_level__lte=5).order_by("name", "rarity_level") friend_codes = self.request.user.friend_codes.all() @@ -245,7 +245,7 @@ class TradeOfferSearchView(ListView): #@silk_profile(name="Trade Offer Search- Get Context Data") def get_context_data(self, **kwargs): context = super().get_context_data(**kwargs) - from cards.models import Card + from pkmntrade_club.cards.models import Card # Populate available_cards to re-populate the multiselects. Exclude cards with rarity level > 5. context["cards"] = Card.objects.filter(rarity_level__lte=5).order_by("name", "rarity_level") if self.request.method == "POST": @@ -604,7 +604,7 @@ class TradeOfferCreateConfirmView(LoginRequiredMixin, View): "initiated_by": request.POST.get("initiated_by"), } # Supply additional context required by trade_offer_create.html. - from cards.models import Card + from pkmntrade_club.cards.models import Card context = { "form": form, "friend_codes": request.user.friend_codes.all(), @@ -623,7 +623,7 @@ class TradeOfferCreateConfirmView(LoginRequiredMixin, View): "want_cards": request.POST.getlist("want_cards"), "initiated_by": request.POST.get("initiated_by"), } - from cards.models import Card + from pkmntrade_club.cards.models import Card context = { "form": form, "friend_codes": request.user.friend_codes.all(), @@ -655,7 +655,7 @@ class TradeOfferCreateConfirmView(LoginRequiredMixin, View): "want_cards": request.POST.getlist("want_cards"), "initiated_by": request.POST.get("initiated_by"), } - from cards.models import Card + from pkmntrade_club.cards.models import Card context = { "form": form, "friend_codes": request.user.friend_codes.all(), @@ -669,7 +669,7 @@ class TradeOfferCreateConfirmView(LoginRequiredMixin, View): have_selections = self._parse_card_selections("have_cards") want_selections = self._parse_card_selections("want_cards") - from cards.models import Card + from pkmntrade_club.cards.models import Card have_cards_ids = [card_id for card_id, _ in have_selections] cards_have_qs = Card.objects.filter(pk__in=have_cards_ids)