File size: 2,876 Bytes
8024c76 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 |
#!/usr/bin/env python3
"""
Deployment Check Script for Streamlit Cloud
Verifies that all necessary files are present and properly configured
"""
import os
import sys
def check_deployment_files():
"""Check if all necessary files exist for Streamlit Cloud deployment"""
print("π Checking Streamlit Cloud Deployment Files...")
# Check main app file
if os.path.exists("frontend/app.py"):
print("β
frontend/app.py exists")
else:
print("β frontend/app.py missing")
return False
# Check requirements.txt
if os.path.exists("requirements.txt"):
print("β
requirements.txt exists")
with open("requirements.txt", "r") as f:
requirements = f.read()
if "streamlit" in requirements:
print("β
streamlit in requirements.txt")
else:
print("β streamlit missing from requirements.txt")
else:
print("β requirements.txt missing")
return False
# Check .gitignore
if os.path.exists(".gitignore"):
print("β
.gitignore exists")
else:
print("β οΈ .gitignore missing (optional)")
# Check for any large files that might cause issues
large_files = []
for root, dirs, files in os.walk("."):
for file in files:
if file.endswith(('.csv', '.json', '.png', '.jpg', '.jpeg')):
filepath = os.path.join(root, file)
size = os.path.getsize(filepath)
if size > 10 * 1024 * 1024: # 10MB
large_files.append((filepath, size))
if large_files:
print("β οΈ Large files detected (may cause deployment issues):")
for filepath, size in large_files:
print(f" {filepath} ({size / 1024 / 1024:.1f}MB)")
else:
print("β
No large files detected")
# Check environment variables
fred_key = os.getenv("FRED_API_KEY")
if fred_key and fred_key != "your-fred-api-key-here":
print("β
FRED_API_KEY environment variable set")
else:
print("β οΈ FRED_API_KEY not set (will use demo mode)")
print("\nπ Streamlit Cloud Configuration Checklist:")
print("1. Main file path: frontend/app.py")
print("2. Git branch: main")
print("3. Repository: ParallelLLC/FREDML")
print("4. Environment variables: FRED_API_KEY")
return True
if __name__ == "__main__":
success = check_deployment_files()
if success:
print("\nβ
Deployment files look good!")
print("If Streamlit Cloud still shows old version, try:")
print("1. Force redeploy in Streamlit Cloud dashboard")
print("2. Check deployment logs for errors")
print("3. Verify branch and file path settings")
else:
print("\nβ Deployment files need attention")
sys.exit(1) |