A Flask-based web application for storing and managing images using Firebase Authentication, Firestore database, and Google Cloud Storage.
- User Authentication: Simple email-based login/signup
- Gallery Management: Create, rename, delete galleries
- Image Upload: Upload JPG, JPEG, PNG images
- Image Management: View, delete images
- Gallery Sharing: Share galleries with other users by email
- Duplicate Detection: Prevents uploading the same image twice
- Responsive Design: Works on desktop and mobile devices
- Python 3.7+
- Google Cloud Project with Firebase enabled
- Firebase service account key
The virtual environment is already configured. To activate it:
# Navigate to project directory
cd "c:\Users\abhic\Downloads\image_storage_service"
# Activate virtual environment
.\venv\Scripts\Activate.ps1- Go to Firebase Console
- Select your project:
image-storage-service-466107 - Go to Project Settings > Service Accounts
- Generate a new private key
- Download the JSON file and rename it to
serviceAccountKey.json - Place it in the project root directory
Make sure your Firebase project has Storage enabled:
- Go to Firebase Console > Storage
- Get started and set up Cloud Storage
- Your bucket name should be:
image-storage-service-466107.appspot.com
# Make sure virtual environment is activated
python main.pyThe application will start on http://127.0.0.1:8080
image_storage_service/
├── main.py # Main Flask application
├── requirements.txt # Python dependencies
├── app.yaml # Google App Engine config
├── serviceAccountKey.json # Firebase credentials (you need to add this)
├── venv/ # Virtual environment
├── templates/ # HTML templates
│ ├── login.html
│ ├── dashboard.html
│ └── gallery.html
└── static/ # Static files (CSS, images)
└── style.css
- Enter any email address
- If the user exists in Firebase, you'll be logged in
- If not, a new user will be created automatically
- Create new galleries from the dashboard
- Rename galleries from the gallery page
- Delete galleries (this also deletes all images)
- Share galleries with other users by email
- Upload images (JPG, JPEG, PNG only)
- View all images in a gallery
- Delete individual images
- Duplicate detection prevents uploading the same image twice
- Change the
app.secret_keyin production - The current authentication is simplified for demo purposes
- In production, implement proper password authentication
Make sure your Firestore security rules allow authenticated users to read/write their own data:
rules_version = '2';
service cloud.firestore {
match /databases/{database}/documents {
match /{document=**} {
allow read, write: if request.auth != null;
}
}
}Configure Cloud Storage rules to allow authenticated uploads:
rules_version = '2';
service firebase.storage {
match /b/{bucket}/o {
match /{allPaths=**} {
allow read, write: if request.auth != null;
}
}
}- ModuleNotFoundError: Make sure virtual environment is activated
- Firebase Credentials Error: Ensure
serviceAccountKey.jsonis in the project root - Storage Bucket Not Found: Verify bucket name in
main.pymatches your Firebase project - Permission Denied: Check Firebase security rules
The application provides helpful error messages through flash notifications for common issues like:
- Invalid file formats
- Duplicate images
- Permission errors
- Authentication failures
To modify the application:
- Edit
main.pyfor backend logic - Edit templates in
templates/for frontend - Edit
static/style.cssfor styling - Test changes locally before deploying
This application is configured for Google App Engine deployment using the included app.yaml file.