How alejandrotejero/gamerank works
Purpose and Runtime
GameRank is a server-rendered Django 5.1 web application for aggregating game catalog data and supporting authenticated user interactions: ratings, comments, comment reactions, follows, profile settings, and JSON game export. It runs via Django’s development/WSGI/ASGI entry points: project/manage.py, project/project/wsgi.py, and project/project/asgi.py. Persistence is SQLite (project/db.sqlite3); remote catalog ingestion uses requests.
Request Routing and Presentation
Project-level routing delegates application URLs through project/project/urls.py and project/gamerank/urls.py. Request handlers in project/gamerank/views.py render Django templates, primarily using shared layout/navigation plus catalog, detail, account, and interaction screens:
• project/gamerank/templates/gamerank/base.html
• project/gamerank/templates/gamerank/detalles_juego.html
• project/gamerank/templates/gamerank/detalles_juego_dinamico.html
Django’s registration/login templates under project/gamerank/templates/registration integrate with the authentication flow.
Domain and Persistence Model
The core domain is defined in project/gamerank/models.py and evolved through project/gamerank/migrations/. It centers on games with source-prefixed stable IDs, stored rating aggregate fields and vote counts; user-to-game ratings; comments; per-user comment votes; game follows; and user profile data. The migrations show the key schema evolution for ratings, followers, profiles, and comment likes/dislikes:
• project/gamerank/migrations/0002_game_rating_game_votes.py
• project/gamerank/migrations/0005_perfilusuario.py
• project/gamerank/migrations/0008_votocomentario.py
Catalog Ingestion Boundary
Catalog synchronization is separated from request views in project/gamerank/manageData.py. This boundary consumes a remote XML feed and the FreeToGame and MMOBomb APIs, normalizes source records, and persists them as games under LIS1-, FTP-, and MMO- ID namespaces. Remote network/API variability is therefore isolated from the local database-backed browsing experience.
Game Interaction Flows
Catalog requests list games ordered by stored aggregate rating and can filter by source prefix. Detail requests combine game metadata with ratings and comments. Authenticated actions update relational state: one rating per user/game is created or revised, then the game’s average and vote count are recalculated; comments are attached to games; comment reactions toggle or switch like/dislike state; and follows create/remove user-game membership. These flows are implemented across project/gamerank/views.py, project/gamerank/forms.py, and project/gamerank/models.py.
Dynamic and Export Interfaces
The dynamic game-detail variant supports HTMX-driven comment refreshes, allowing a fragment response rather than a full document reload:
• project/gamerank/templates/gamerank/detalles_juego_dinamico.html
• project/gamerank/templates/gamerank/comments.html
A separate view path exposes individual game information as JSON for download/API-like consumption. This is a server-generated export over the same persisted game model, not a separate service.
User Experience and Shared UI
Shared navigation, footer content, and styling support the server-rendered interface:
• project/gamerank/templates/gamerank/navbarFuncional.html
• project/gamerank/manageFooter.py
• project/gamerank/static/css/style.css
User-facing account pages surface voting metrics, followed/voted games, and profile alias/font preferences through the same Django session/authentication boundary.
Main entry points: views.py Request handlers · models.py GameRank models · manageData.py Catalog synchronization · urls.py Project routing
Components 17
Django Runtime
- Django entry points · Development, WSGI, and ASGI startup.
project/manage.py - Project routing
project/project/urls.py
Web UI
- GameRank routes
project/gamerank/urls.py - Request handlers · Catalog, detail, account, interaction, and JSON export handlers.
project/gamerank/views.py - Interaction forms
project/gamerank/forms.py - Session authentication · Registration and login use Django authentication templates.
project/gamerank/templates/registration - Server-rendered screens · Shared layout, catalog, game details, and account pages.
project/gamerank/templates/gamerank/base.html - HTMX game detail · Refreshes comments without a full document reload.
project/gamerank/templates/gamerank/detalles_juego_dinamico.html - Comments fragment
project/gamerank/templates/gamerank/comments.html - Shared styling
project/gamerank/static/css/style.css - Game JSON export · Exports an individual persisted game; not a separate service.
project/gamerank/views.py
Domain & Data
- GameRank models · Games, ratings, comments, reactions, follows, and user profiles.
project/gamerank/models.py - Schema evolution · Adds rating aggregates, profiles, and comment reactions.
project/gamerank/migrations/0008_votocomentario.py - GameRank database · Local persisted catalog and user interaction state.
project/db.sqlite3 - Rating aggregation · One rating per user/game; game average and vote count are recalculated.
project/gamerank/views.py
Catalog Sync
- Catalog synchronization · Normalizes remote records into stable source-prefixed game IDs.
project/gamerank/manageData.py - Remote catalog sources · XML feed, FreeToGame, and MMOBomb supply catalog records.
Connections 19
- Django entry points → Project routing: starts Django routing
- Project routing → GameRank routes: includes app URLs
- GameRank routes → Request handlers: dispatches requests
- Request handlers → Interaction forms: validates writes
- Request handlers → Session authentication: uses authenticated sessions
- Request handlers → Server-rendered screens: renders full pages
- Request handlers → HTMX game detail: serves dynamic detail
- HTMX game detail → Comments fragment: HTMX refresh
- Server-rendered screens → Shared styling: applies shared CSS
- Request handlers → GameRank models: queries and updates
- Interaction forms → GameRank models: maps interaction input
- GameRank models → GameRank database: persists relational state
- Schema evolution → GameRank database: defines schema
- Request handlers → Rating aggregation: rating create or revision
- Rating aggregation → GameRank models: updates rating fields
- Catalog synchronization → Remote catalog sources: fetches with requests
- Catalog synchronization → GameRank models: normalizes and persists games
- Request handlers → Game JSON export: serializes game detail
- Game JSON export → GameRank models: reads persisted game