Files
Refactored-App/backend/README.md
2026-04-01 03:57:04 +02:00

38 lines
1.7 KiB
Markdown

# Django Port
This is the replacement backend for the legacy FastAPI app.
## Shape
- `config/`: Django project settings and URL root
- `apps/accounts`: users, roles, business access, device registration
- `apps/core`: businesses, vendors, products, categories
- `apps/operations`: invoices, inventory, events, schedules
- `apps/reporting`: dashboard-facing revenue aggregates
- `apps/notifications`: reminders and inbox items
- `apps/api`: JSON endpoints for the Svelte frontend
## Expected setup
1. Create a virtualenv in `backend/`.
2. Install dependencies from [`pyproject.toml`](pyproject.toml) with `pip install -e .`.
3. Copy [`backend/.env.example`](.env.example) to `.env` or export the same variables in your shell.
4. Run `python manage.py migrate`.
5. Run `python manage.py createsuperuser` if you are starting from a blank DB.
6. Run `python manage.py import_legacy_data` if you want to rebuild from the bundled legacy sources instead of using the committed `db.sqlite3`.
The import command now defaults to the bundled databases inside:
- [`../data/legacy/cincin_phase1.sqlite`](../data/legacy/cincin_phase1.sqlite)
- [`../data/legacy/dalcorso.sqlite`](../data/legacy/dalcorso.sqlite)
You can still override them with `LEGACY_CINCIN_DB` and `LEGACY_DALCORSO_DB` if needed.
## Notes
- Auth uses Django sessions instead of custom JWT cookies.
- The import command consolidates both legacy SQLite files into one Django schema.
- Password hashes are not carried over directly; imported users get a forced reset placeholder.
- The backend is intended to be runnable from the `django-port` subtree without depending on workspace-root data files.
- The committed `db.sqlite3` is optional but supported. Keep it in the repo if you want seeded data to travel with the project.