Spaces:
Running
Running
hodfa840 commited on
Commit ·
b94a21b
1
Parent(s): 13477a3
Fix import_projects: use password 12345 to match ensure_admin.py
Browse filesensure_admin.py hardcodes PASSWORD="12345" and runs before import_projects.py.
import_projects.py was using LABEL_STUDIO_PASSWORD env var (SagaAdmin2026!)
which no longer works after ensure_admin resets it — causing all 20 login
attempts to fail and no projects to be created.
- import_projects.py +3 -2
import_projects.py
CHANGED
|
@@ -10,7 +10,7 @@ LS = "http://localhost:8080"
|
|
| 10 |
PROJ_DIR = "/app/projects"
|
| 11 |
|
| 12 |
ADMIN_EMAIL = os.environ.get("LABEL_STUDIO_USERNAME", "admin@saga.is")
|
| 13 |
-
ADMIN_PASSWORD =
|
| 14 |
|
| 15 |
|
| 16 |
def get_session():
|
|
@@ -23,7 +23,8 @@ def get_session():
|
|
| 23 |
raise RuntimeError(f"login page {r.status_code}")
|
| 24 |
|
| 25 |
csrf = session.cookies.get("csrftoken", "")
|
| 26 |
-
m = re.search(r'name="csrfmiddlewaretoken"
|
|
|
|
| 27 |
if m:
|
| 28 |
csrf = m.group(1)
|
| 29 |
|
|
|
|
| 10 |
PROJ_DIR = "/app/projects"
|
| 11 |
|
| 12 |
ADMIN_EMAIL = os.environ.get("LABEL_STUDIO_USERNAME", "admin@saga.is")
|
| 13 |
+
ADMIN_PASSWORD = "12345" # must match ensure_admin.py hardcoded value
|
| 14 |
|
| 15 |
|
| 16 |
def get_session():
|
|
|
|
| 23 |
raise RuntimeError(f"login page {r.status_code}")
|
| 24 |
|
| 25 |
csrf = session.cookies.get("csrftoken", "")
|
| 26 |
+
m = (re.search(r'name="csrfmiddlewaretoken"[^>]*value="([^"]+)"', r.text) or
|
| 27 |
+
re.search(r'value="([^"]+)"[^>]*name="csrfmiddlewaretoken"', r.text))
|
| 28 |
if m:
|
| 29 |
csrf = m.group(1)
|
| 30 |
|