Section 4
Persistent file storage
Your app's filesystem is ephemeral. Any file written outside /app/storage is deleted on every redeployment, restart, or rebuild.
The platform provides a persistent directory at /app/storage. This path survives everything — use it for any file that must outlive a deploy.
✓ /app/storage/uploads/ # uploaded files — persists
✓ /app/storage/generated/ # PDFs, exports — persists
✗ /app/uploads/ # wiped on redeploy
✗ /tmp/ # wiped on restart
✗ BASE_DIR/media/ # wiped on rebuild
Never write to paths inside your code directory. When the platform rebuilds your app, the entire code tree is replaced. Only
/app/storage (exposed as APP_STORAGE) survives.Read the storage path from the environment so your code works identically in local development and production:
python
import os
UPLOAD_DIR = os.environ.get('APP_STORAGE', '/tmp/storage')javascript
const UPLOAD_DIR = process.env.APP_STORAGE ?? '/tmp/storage';