This page covers everything you need to install and configure Pokédex Web App for local development. You will find the exact system requirements, instructions for creating an isolated Python environment, a breakdown of every dependency, details on how the SQLite database is initialised automatically, and guidance on securing the Flask secret key before deploying to production.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/Navi-27/Proyecto-UPC/llms.txt
Use this file to discover all available pages before exploring further.
Prerequisites
Before you begin, make sure the following are available on your system:- Python 3.8 or later — the app uses f-strings,
sqlite3, and other features that require Python 3.8+. Verify withpython --version. - pip — Python’s package installer, bundled with all modern Python distributions.
- git — required to clone the repository from GitHub.
- Internet access — needed on first run to fetch all 1025 Pokémon from
https://pokeapi.co/api/v2. Subsequent starts work fully offline from the local SQLite cache.
Virtual Environment Setup
Always install the project inside a virtual environment to avoid conflicts with other Python projects on your system.- Windows
- macOS / Linux
(venv) prepended to your command prompt, indicating the environment is active. To deactivate later, run deactivate.Dependencies
Install all dependencies in one step:requirements.txt file specifies four packages:
| Package | Role in this project |
|---|---|
flask | Core web framework. Handles routing, the request/response cycle, session management, and Jinja2 template rendering for all pages (index.html, detalle.html, equipo.html, etc.). |
requests | HTTP client used by the PokeAPI service class to call https://pokeapi.co/api/v2 — both for the bulk 1025-Pokémon download on first run and for individual lookups when a Pokémon is not found in the cache. |
gunicorn | Production-grade WSGI server. Defined in Procfile as web: gunicorn application:application so the app can be deployed to any compatible platform without code changes. |
werkzeug | Security and utility library bundled with Flask. Used for password hashing and verification in the Usuario model to safely store and authenticate user credentials. |
Database Initialisation
No manual database setup is required. When the Flask application starts,init_db() is called automatically inside an application context:
init_db() (defined in models/database.py) connects to pokedex.db at the project root and runs CREATE TABLE IF NOT EXISTS statements for four tables:
| Table | Purpose |
|---|---|
usuarios | Stores registered user accounts (username + hashed password). |
equipos | Stores each user’s team — up to 6 Pokémon with their ID, name, image URL, and types. |
cache_pokemon | Local cache of all 1025 Pokémon fetched from PokéAPI (id, name, types, height, weight, image, stats). |
pokedex_usuario | Records which Pokémon each user has viewed, with a timestamp. |
pokedex.db does not exist, SQLite creates it automatically. The schema is fully idempotent — restarting the app never drops or modifies existing data.
Secret Key Configuration
The Flask app sets a default secret key used to cryptographically sign session cookies:secrets module to generate one:
application.py:
Production Deployment
Pokédex Web App ships with aProcfile that configures Gunicorn as the production WSGI server:
gunicorn <module>:<wsgi_callable>. Here, application (the module, i.e. application.py) exposes the Flask instance also named application. To start the production server manually, run:
0.0.0.0:8000 by default and handle concurrent requests using its pre-fork worker model, making it safe and performant for real traffic.