Ensure uploaded images are permanently stored in object storage

Integrates Replit Object Storage for persistent file uploads, replacing ephemeral local storage and adding `google-cloud-storage` dependency.

Replit-Commit-Author: Agent
Replit-Commit-Session-Id: cd9a7d26-a4e5-4215-975c-c59f4ed1f06d
Replit-Commit-Checkpoint-Type: full_checkpoint
Replit-Commit-Event-Id: 093bebfc-3b06-4716-8c6a-2dea6a89816d
Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/d0a1d46d-d203-4308-bc6a-312ac7c0243b/cd9a7d26-a4e5-4215-975c-c59f4ed1f06d/D3TcT39
This commit is contained in:
abhiramtx
2025-11-13 05:36:58 +00:00
parent 01623ac850
commit f4d32ff9ee
7 changed files with 740 additions and 22 deletions

View File

@@ -3,6 +3,40 @@
## Overview
Flask-based website for FTC Team 23344 with a modern dark theme (#000000 pure black background), comprehensive content management system, PostgreSQL database integration, and premium smooth-scrolling animations.
## Recent Changes (November 13, 2025)
### Critical Fix: Persistent Object Storage for Uploaded Files
Fixed the issue where uploaded images (members, mentors, competitions, sponsors) were disappearing after a few hours.
**The Problem:**
- Files were being saved to local filesystem (`static/images/`)
- Local storage in Replit is **ephemeral** and gets cleared periodically
- All uploaded images would vanish after a few hours
**The Solution:**
- Migrated to **Replit Object Storage** (built on Google Cloud Storage)
- All file uploads now go to **persistent, permanent storage**
- Images are served directly from Google's CDN with full URLs
**Technical Implementation:**
- Created `object_storage.py` module using Google Cloud Storage Python client
- Updated all upload routes to use object storage:
- `add_member()`, `update_member()` - Member/mentor photos
- `add_competition()`, `edit_competition()` - Competition images
- `add_sponsor()` - Sponsor logos
- Intelligent fallback: uses local storage if object storage not configured
- Files organized by type: `members/`, `competitions/`, `sponsors/` folders
- Unique UUIDs prevent filename conflicts
- Public URLs stored in database instead of local paths
**Setup Required (See OBJECT_STORAGE_SETUP.md):**
1. Create bucket in Object Storage pane
2. Set `OBJECT_STORAGE_BUCKET` environment variable
3. Restart server
**Dependencies Added:**
- `google-cloud-storage` (v3.5.0)
## Recent Changes (November 12, 2025)
### Admin Panel Enhancement: Competition Editing