|
|
|
|
|
""" |
|
|
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...") |
|
|
|
|
|
|
|
|
if os.path.exists("frontend/app.py"): |
|
|
print("β
frontend/app.py exists") |
|
|
else: |
|
|
print("β frontend/app.py missing") |
|
|
return False |
|
|
|
|
|
|
|
|
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 |
|
|
|
|
|
|
|
|
if os.path.exists(".gitignore"): |
|
|
print("β
.gitignore exists") |
|
|
else: |
|
|
print("β οΈ .gitignore missing (optional)") |
|
|
|
|
|
|
|
|
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: |
|
|
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") |
|
|
|
|
|
|
|
|
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) |