fix: persist preview admin access

This commit is contained in:
mohamad
2026-10-29 04:00:21 +08:00
parent 641f4e6cee
commit cb54e96db6
5 changed files with 75 additions and 2 deletions
+19
View File
@@ -118,6 +118,25 @@ python manage.py ensure_superuser
python manage.py runserver
```
### Persistent local preview without Docker
The local preview uses `instance/preview.sqlite3`, which survives server restarts and is
ignored by Git. Put the preview admin credentials in `instance/preview_admin.env`
(also ignored by Git):
```text
DJANGO_SUPERUSER_USERNAME=admin
DJANGO_SUPERUSER_EMAIL=admin@localhost
DJANGO_SUPERUSER_PASSWORD=your-local-password
DJANGO_SUPERUSER_SYNC_PASSWORD=False
```
Then start the preview with `./run_preview.sh`. It applies migrations and ensures the
admin account exists before starting the server. Existing passwords are preserved;
set `DJANGO_SUPERUSER_SYNC_PASSWORD=True` for one start only if you intentionally
need to reset the account password. This preview database is separate from the
PostgreSQL database used by Docker and production.
## Management commands
```bash