chore(infra): port 9000, make help, db skip-check, Vite CSS fix

- Django dev server now runs on :9000 (was :8000)
- `make` without args shows all targets with descriptions
- `make db` skips docker start if :5432 already reachable (nc check)
- `make seed` and `make superuser` added as explicit targets
- vite.config.js: assetFileNames without hash so static/dist/main.css
  matches the {% static 'dist/main.css' %} reference in base.html
  (run `npm run build` once after checkout to regenerate the CSS file)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-05-13 00:18:34 +02:00
parent ff3349164b
commit a9f7a3f801
3 changed files with 38 additions and 19 deletions

View File

@@ -14,14 +14,17 @@ The authoritative requirements are in `wiki/ProductRequirementsDocument.md`. Tec
## Entwicklungs-Commands
Run `make` without arguments for a full list with descriptions.
```bash
make db # PostgreSQL via Docker starten (oder infra-postgres-1 verwenden)
make dev # Django-Dev-Server (Port 8000)
make css # Tailwind CSS im Watch-Modus
make db # PostgreSQL starten (Noop wenn :5432 bereits erreichbar)
make css # Tailwind CSS Watch-Modus — Terminal A, laufen lassen
make dev # Django-Dev-Server auf :9000 — Terminal B
make seed # Seed-Daten laden (idempotent)
make superuser # Superuser anlegen (einmalig für /admin/)
make migrate # Migrations generieren und ausführen
make test # pytest ausführen
make lint # ruff + mypy
uv run manage.py test vergabe_teilnahme.apps.<app> # Einzelne App testen
uv run pytest vergabe_teilnahme/apps/<app>/tests/ # Einzelne Testdatei
```

View File

@@ -1,30 +1,43 @@
.PHONY: dev db migrate shell test lint css createsuperuser collectstatic
.PHONY: help db dev css seed migrate test lint shell superuser collectstatic
db:
docker compose -f docker-compose.dev.yml up -d 2>/dev/null || echo "DB already running"
.DEFAULT_GOAL := help
dev:
uv run manage.py runserver 0.0.0.0:8000
help: ## List available make targets
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) \
| awk 'BEGIN {FS = ":.*?## "}; {printf " \033[36m%-16s\033[0m %s\n", $$1, $$2}'
css:
db: ## Start PostgreSQL via Docker (skips if already reachable on :5432)
@if nc -z localhost 5432 2>/dev/null; then \
echo "✓ DB bereits erreichbar auf :5432 — kein Docker-Start nötig"; \
else \
docker compose -f docker-compose.dev.yml up -d; \
fi
dev: ## Start Django dev server on :9000
uv run manage.py runserver 0.0.0.0:9000
css: ## Start Tailwind CSS watcher (Vite, rebuild on change)
npm run dev
migrate:
seed: ## Load dev seed data — users, one Ausschreibung, Lose, etc. (idempotent)
uv run manage.py seed_dev
superuser: ## Create a Django superuser for /admin/ access
uv run manage.py createsuperuser
migrate: ## Generate and apply all pending migrations
uv run manage.py makemigrations
uv run manage.py migrate
shell:
uv run manage.py shell_plus 2>/dev/null || uv run manage.py shell
test:
test: ## Run the full pytest test suite
uv run pytest
lint:
lint: ## Run ruff (style) and mypy (types)
uv run ruff check .
uv run mypy vergabe_teilnahme/
createsuperuser:
uv run manage.py createsuperuser
shell: ## Open a Django shell (shell_plus if available)
uv run manage.py shell_plus 2>/dev/null || uv run manage.py shell
collectstatic:
collectstatic: ## Collect static files into staticfiles/ (production step)
uv run manage.py collectstatic --noinput

View File

@@ -8,6 +8,9 @@ export default defineConfig({
emptyOutDir: true,
rollupOptions: {
input: 'static/src/main.css',
output: {
assetFileNames: '[name][extname]',
},
},
},
})