Spaces:
Running
Running
OfoqERP Deploy
fix: create tabRole table manually before seeding roles, add Guest enabled safety net
761ff32 | """Poll the Frappe health check endpoint until setup completes or errors.""" | |
| import requests, time, sys | |
| URL = "https://hisham-cmd-ofoqerp.hf.space/api/method/frappe.utils.check" | |
| for i in range(30): | |
| try: | |
| r = requests.get(URL, timeout=20) | |
| if r.ok: | |
| try: | |
| d = r.json() | |
| except: | |
| d = {} | |
| msg = d.get("message", d.get("status", "?")) | |
| print(f" [{i+1}] {r.status_code} -> {msg}") | |
| # setting_up = still initializing, not fully deployed = same | |
| status_text = str(d).lower() | |
| if "setting_up" not in status_text and "not fully deployed" not in status_text and "server" in d: | |
| print(f"\n >>> SETUP COMPLETE!") | |
| print(f" Server: {d.get('server', '?')}") | |
| print(f" Message: {d.get('message', '?')}") | |
| sys.exit(0) | |
| else: | |
| print(f" [{i+1}] HTTP {r.status_code}: {r.text[:100]}") | |
| except Exception as e: | |
| print(f" [{i+1}] error: {e}") | |
| print(f" (waiting 30s...)") | |
| time.sleep(30) | |
| print("\n Timed out after 15 min") | |
| sys.exit(1) | |