Update AGENTS.md
This commit is contained in:
@@ -3,80 +3,55 @@
|
|||||||
## Commands
|
## Commands
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# Run tests (runs tienda/tests.py by default)
|
make test # Run tests
|
||||||
make test
|
python manage.py runserver # Dev server
|
||||||
|
python manage.py migrate # Migrations
|
||||||
# Or manually
|
python manage.py collectstatic # Static files (production)
|
||||||
python manage.py test
|
|
||||||
|
|
||||||
# Run dev server
|
|
||||||
python manage.py runserver
|
|
||||||
|
|
||||||
# Run migrations
|
|
||||||
python manage.py migrate
|
|
||||||
|
|
||||||
# Static files (production)
|
|
||||||
python manage.py collectstatic
|
|
||||||
```
|
```
|
||||||
|
|
||||||
## Prerequisites
|
## Prerequisites
|
||||||
|
|
||||||
- **Redis**: Must be running on `redis://127.0.0.1:6379/1` for sessions and caching
|
- **Redis**: `redis://127.0.0.1:6379/1` (Linux: `sudo systemctl start redis-server`)
|
||||||
- Start: `sudo systemctl start redis-server` (Linux) or `brew services start redis` (macOS)
|
- **PostgreSQL**: Default. Set `POSTGRES_ENABLED=False` for SQLite
|
||||||
- Verify: `redis-cli ping` → PONG
|
- **Environment**: Copy `.env.example` to `.env`
|
||||||
- **PostgreSQL**: Default database; set `POSTGRES_ENABLED=False` to use SQLite
|
|
||||||
- **Environment**: Copy `.env.example` to `.env` and configure required vars
|
|
||||||
|
|
||||||
## Important Quirks
|
## Quirks
|
||||||
|
|
||||||
1. **Migrations**: If `makemigrations` fails with error code 130, **check `tienda/migrations/`** - the file is often created despite the error
|
1. **Migrations**: If `makemigrations` fails with error 130, check `tienda/migrations/` - file often created anyway
|
||||||
2. **Test DB**: Uses SQLite regardless of POSTGRES_ENABLED (hardcoded in settings.py)
|
2. **Test DB**: Always uses SQLite (hardcoded)
|
||||||
3. **App URL**: Not at `/` - access at `http://localhost:8000/tienda/`
|
3. **App URL**: `http://localhost:8000/tienda/` (not `/`)
|
||||||
4. **Admin**: At `/admin/` (not `/tienda/admin/`)
|
4. **Admin**: `/admin/`
|
||||||
5. **Custom User Model**: AUTH_USER_MODEL = 'tienda.User' - use for all user-related queries
|
5. **User Model**: Use `tienda.User` for queries
|
||||||
|
|
||||||
## Architecture
|
## Architecture
|
||||||
|
|
||||||
- `proyecto/` - Django settings, URLs, WSGI/ASGI
|
- `proyecto/` - Django settings, URLs, WSGI/ASGI
|
||||||
- `tienda/` - Main app (models, views, admin, templates)
|
- `tienda/` - Main app (models, views, admin, templates)
|
||||||
- `tienda/static/` - CSS, JS, images, fonts
|
|
||||||
- Templates extend `tienda/templates/tienda/base.html`
|
- Templates extend `tienda/templates/tienda/base.html`
|
||||||
|
|
||||||
## Shipping Restrictions
|
## Shipping
|
||||||
|
|
||||||
Only sells to Almería province, Spain (postal codes 04xxx). All addresses saved with country "España".
|
Only Almería province, Spain (04xxx). Country: "España".
|
||||||
|
|
||||||
## External Services
|
## External Services
|
||||||
|
|
||||||
- **Payment**: Stripe + PayPal (configured via .env)
|
- **Payment**: Stripe + PayPal (via .env)
|
||||||
- **Storage**: S3 support - set `S3_ENABLE=True` to enable
|
- **Storage**: S3 - set `S3_ENABLE=True`
|
||||||
- **Email**: SMTP required (see .env.example)
|
- **Email**: SMTP (see .env.example)
|
||||||
- **Async**: Celery uses Redis broker
|
- **Async**: Celery + Redis
|
||||||
|
|
||||||
## Useful References
|
## Deploy
|
||||||
|
|
||||||
- Full developer docs: `.github/copilot-instructions.md`
|
- Push to `origin` and `github` after changes
|
||||||
- Redis setup: `docs/REDIS_SETUP.md`
|
- GitHub Actions updates `ghcr.io/dsaub/proyecto-mvc:development`
|
||||||
- PayPal: `docs/PAYPAL_SETUP.md`, `docs/PAYPAL_TROUBLESHOOTING.md`
|
- SSH: `debian@172.16.14.221` (requires VPN - skip if unavailable)
|
||||||
- View documentation: `docs/views/`
|
- Stack: `/home/debian/composes/mvc/mvc.yml` on swarm
|
||||||
|
- Timeout: 1 minute max when updating services
|
||||||
|
- Docker job requires Test job to pass first
|
||||||
|
|
||||||
# Adittional Information
|
## Other
|
||||||
|
|
||||||
- Use Github CLI to manage GitHUB Issues and Pull Requests
|
- **Repo**: https://github.com/dsaub/proyecto-final
|
||||||
- Repo is https://github.com/dsaub/proyecto-final
|
- **Python**: 3.14, use `.venv` virtualenv
|
||||||
- Strictly use virtualenvs on .venv folder, if not exists, create it, make sure to use Python 3.14
|
- **GIT**: origin → git.elordenador.org, github → GitHub
|
||||||
|
- **Docs**: `.github/copilot-instructions.md`, `docs/`
|
||||||
|
|
||||||
# GIT Remotes
|
|
||||||
- origin (main) Defaults to https://git.elordenador.org/elordenador/proyecto-final (via SSH)
|
|
||||||
- github Defaults to the GITHUB repo
|
|
||||||
- gitlab Defaults to a Gitlab mirror (doesn't work by now)
|
|
||||||
|
|
||||||
# Deploy machine info.
|
|
||||||
- Every time you make a change, please commit it and push it to "origin and github", and verify github actions succeeded.
|
|
||||||
- When Github Actions succeed, it will update the docker image "ghcr.io/dsaub/proyecto-mvc:development".
|
|
||||||
- When "ghcr.io/dsaub/proyecto-mvc:development" updates, that affects swarm mvc_web and mvc_worker services, so update them
|
|
||||||
- You can SSH docker swarm "Docker 1" instance at debian@172.16.14.221
|
|
||||||
- Docker SWARM is in my school's OpenStack, needing the VPN, if you can't connect, OMIT the deploy, if you can, then do.
|
|
||||||
- Docker Swarm Stack is at /home/debian/composes/mvc/mvc.yml. That file is on "debian@172.16.14.221" server.
|
|
||||||
- WARNING: Updating the Docker SWARM SERVICE can HANG UP indefinitely, apply a 1-minute time out so if it's still executing it stops it by force
|
|
||||||
Reference in New Issue
Block a user