Habadashi Login Gateway - Local Testing Guide
Prerequisites
Environment variables must be set:
SUPABASE_URL: Your Supabase project URLSUPABASE_KEY: Your Supabase anon/service keyHF_TOKEN: Hugging Face token with access to privateDLPO/habadashiSpaceOPENAI_KEY: OpenAI API key (required by ver20)CLIENTPOOL: Client pool configuration (required by ver20)
Install dependencies:
pip install -r requirements.txt
Local Testing Steps
Step 1: Set environment variables
PowerShell (Windows):
$env:SUPABASE_URL="your-supabase-url"
$env:SUPABASE_KEY="your-supabase-key"
$env:HF_TOKEN="your-hf-token"
$env:OPENAI_KEY="your-openai-key"
$env:CLIENTPOOL="your-client-pool"
Bash (Linux/Mac):
export SUPABASE_URL="your-supabase-url"
export SUPABASE_KEY="your-supabase-key"
export HF_TOKEN="your-hf-token"
export OPENAI_KEY="your-openai-key"
export CLIENTPOOL="your-client-pool"
Step 2: Test bootstrap (download private app)
python bootstrap.py
Expected output:
π Downloading private app from DLPO/habadashi...β Download complete: ./private_appπ Bootstrap test successful!
This will create a ./private_app/ directory with ver20 files.
Step 3: Start the application
uvicorn app:app --host 0.0.0.0 --port 7860
Or use Gradio's default launch (if app.py is configured to run directly):
python app.py
Step 4: Verify routes
Root route: http://localhost:7860/
- Should redirect to
/login/if not authenticated - Should redirect to
/app/if authenticated
- Should redirect to
Login UI: http://localhost:7860/login/
- Enter email and password
- On success, should set cookie and redirect to
/app/
Protected app: http://localhost:7860/app/
- Should show ver20 Gradio interface if authenticated
- Should redirect to login if not authenticated
Logout: http://localhost:7860/logout
- Should clear cookie and redirect to
/login/
- Should clear cookie and redirect to
Troubleshooting
Issue: "HF_TOKEN not found"
- Make sure
HF_TOKENis set in environment variables - Verify token has access to private
DLPO/habadashiSpace
Issue: "Failed to import ver20 app"
- Check that
./private_app/app.pyexists - Verify ver20's
app.pyexportsappvariable (Gradio Blocks instance) - Check Python path is correctly set
Issue: "SUPABASE_URL and SUPABASE_KEY must be set"
- Set both environment variables before running the app
Issue: Cookie not persisting (localhost HTTP)
- For local development, you may need to modify cookie settings in
login.py - Remove
Secureflag for HTTP testing:SameSite=Lax;(removeSecure;)
Deployment to HF Space
Once local testing is successful, deploy to public HF Space:
- Create new public Space:
DLPO/habadashi_login - Set secrets in Space settings:
SUPABASE_URLSUPABASE_KEYHF_TOKENOPENAI_KEYCLIENTPOOL
- Upload files:
app.pybootstrap.pylogin.pyrequirements.txtREADME.md
The Space will automatically:
- Download ver20 from private
DLPO/habadashion startup - Mount login UI at
/login/ - Mount ver20 app at
/app/(protected by auth)