-
Notifications
You must be signed in to change notification settings - Fork 0
Troubleshooting
The package isn't installed. Run:
pip install -e .Or ensure requirements.txt is installed:
pip install -r requirements.txtThere's a package name conflict. The system needs sqlalchemy-datatables, not datatables. Fix:
pip uninstall datatables
pip install sqlalchemy-datatablesThe config file doesn't match the expected study name. Check:
-
URAND_CONFIG_FILEpoints to the right file -
URAND_STUDY_NAMEmatches a top-level key in that file - The study section has
treatmentsandfactorsdefined
The database hasn't been initialized. Run:
flask createdbYou're trying to randomize a participant with an ID that already exists. Each participant ID must be unique within a study. Check existing participants:
urn -s "Study Name" export /tmp/check.csv && grep P001 /tmp/check.csvSQLite allows only one writer at a time. If a process crashed mid-write, the lock file (.db-wal, .db-shm) may persist. Wait a moment and retry — if the issue persists:
# Check for processes using the database
lsof urn-randomization.db
# If safe, remove the WAL files (ensure no other process is writing)
rm urn-randomization.db-wal urn-randomization.db-shm-
OAuth not configured: Check that
GOOGLE_OAUTH_CLIENT_IDandGOOGLE_OAUTH_CLIENT_SECRETare set. -
User not registered: The Google email must match a user created with
flask add_user. -
Session issues: Ensure
FLASK_SECRET_KEYis set. Without it, sessions won't persist across requests.
-
Bokeh version mismatch: The app requires Bokeh 3.x. Check:
python -c "import bokeh; print(bokeh.__version__)" - JavaScript blocked: Ensure your browser allows JavaScript from CDN sources. Bokeh loads its JS library from CDN.
The server-side DataTable endpoint (/dtbl_participants) may be failing. Check the Flask console for errors. Common causes:
- Database connection issues
- Missing
sqlalchemy-datatablespackage
Check that the user is authenticated. Content is only rendered inside the {% if current_user.is_authenticated %} block.
A required parameter is missing. The API returns specific messages for each case:
- Missing study:
"Please pass a study name with your request." - Missing participant ID:
"Please pass the participant id with your request." - Missing factor:
"Please pass a value for factor {name} with your request." - Invalid factor value:
"Invalid level supplied for factor {name}. Allowed levels are: [...]"
The API key is invalid. Verify it:
flask list_usersThe study parameter doesn't match any study in the config. The name must match exactly (case-sensitive, including spaces).
Factor values must exactly match the levels defined in the config (case-sensitive). Check valid values:
curl "http://localhost:5000/study_config?api_key=KEY&study=Study+Name"The package isn't installed with the entry point. Install with:
pip install -e .Or run directly:
python -m urand.cli -s "Study Name" randomize --id P001 --user adminIt may have run successfully but silently. Check the database file exists:
ls -la urn-randomization.dbEnsure requirements.txt includes all dependencies. The render.yaml build command should install them:
buildCommand: pip install -r requirements.txt && flask init-demoWith Gunicorn, Flask serves static files. If behind a reverse proxy, ensure it's configured to pass through /static/ requests or serve them directly.
- Add the production redirect URI to Google Cloud Console:
https://your-domain.com/login/google/authorized - Ensure HTTPS is enabled (Google requires it for OAuth redirects in production)
- Set
OAUTHLIB_INSECURE_TRANSPORT=1only for local HTTP development — never in production