Spaces:
Sleeping
Sleeping
|
Download GOOGLE_DRIVE_SETUP.md from refaelz/legacy-code-challenge: direct link, hf CLI and curl.
- Browser
- Download file 3.28 kB
-
https://huggingface.co/spaces/refaelz/legacy-code-challenge/resolve/main/GOOGLE_DRIVE_SETUP.md
- Command line
-
hf download hf://spaces/refaelz/legacy-code-challenge/GOOGLE_DRIVE_SETUP.md
-
curl -L -o GOOGLE_DRIVE_SETUP.md https://huggingface.co/spaces/refaelz/legacy-code-challenge/resolve/main/GOOGLE_DRIVE_SETUP.md
3.28 kB
A newer version of the Gradio SDK is available: 6.33.0
Google Drive Backup Setup Guide
================================
Google Drive backup creates detailed submission folders with all files for each student.
What Gets Saved
Each submission creates a folder in your Drive:
π Legacy Code Submissions/
π 2026-05-19_1430_StudentName_RepoName/
π 1_challenge_prompt.md β The full challenge description
π 2_original_code.py β Original code before bugs
π 3_buggy_code.py β Code with bugs (what student got)
π 4_student_solution.py β What the student submitted
π 5_chat_history.txt β Full conversation with AI
π 6_summary.json β Scores, tests, metadata
Setup Instructions
Step 1: Enable Google Drive API
- Go to: https://console.cloud.google.com
- Select your project: "Legacy Code Challenge"
- Navigate to: APIs & Services β Library
- Search for: "Google Drive API"
- Click on it β Click "Enable"
Step 2: Create Folder in Google Drive
- Go to: https://drive.google.com
- Create a new folder: "Legacy Code Submissions"
- Right-click the folder β Share
- Add your service account email:
- Open
google-service-account.json - Find
"client_email"field - Copy the email (e.g.,
legacy-code-logger@...iam.gserviceaccount.com) - Paste it in the Share dialog
- Open
- Give it Editor permissions
- Click Share (uncheck "Notify people")
Step 3: Get Folder ID
- Open the folder you just created
- Look at the URL in your browser:
https://drive.google.com/drive/folders/1abc123XYZ456... ^^^^^^^^^^^^^^^ This is the Folder ID - Copy the Folder ID (the part after
/folders/)
Step 4: Add to Environment Variables
Add to your .env file:
GOOGLE_DRIVE_FOLDER_ID=1abc123XYZ456...
Testing Locally
- Make sure
google-service-account.jsonis in the project root - Make sure
GOOGLE_DRIVE_FOLDER_IDis in.env - Run the test:
python google_drive_logger.py test - Check your Drive folder - you should see a test submission!
For Render Deployment
The same google-service-account.json and environment variables work on Render.
Already done:
- β
google-service-account.jsonuploaded to Render (Secret Files) - β
GOOGLE_SHEET_IDin Render Environment Variables
To add:
- Add
GOOGLE_DRIVE_FOLDER_IDto Render Environment Variables:- Render Dashboard β Settings β Environment
- Add environment variable:
Key: GOOGLE_DRIVE_FOLDER_ID Value: [paste your folder ID here] - Save Changes β Redeploy
What You'll See
After each student submits:
- β Google Sheets - New row in dashboard (real-time overview)
- β Google Drive - New folder with 6 files (detailed backup)
Both update automatically and persist forever!
Security Notes
- The service account can only access:
- The specific Sheet you shared with it
- The specific Drive folder you shared with it
- No access to your other files
- Both are already restricted by API scope (Sheets + Drive only)