Fixed critical runtime error where backend service couldn't import shared modules (ModuleNotFoundError: No module named 'database'). Changes: - Updated Install-BackendFirstTime: Set PYTHONPATH to shared directory instead of parent directory - Added Fix-BackendPythonPath.ps1: Quick fix script for existing installations The backend imports 'from database.oracle_pool' which requires the database module to be in PYTHONPATH. Previously PYTHONPATH pointed to C:\inetpub\wwwroot\roa2web but the database module is located at C:\inetpub\wwwroot\roa2web\shared\database. Now PYTHONPATH correctly points to the shared directory. For existing installations, run Fix-BackendPythonPath.ps1 as Administrator to update the service configuration without reinstalling. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
32 lines
1.0 KiB
PowerShell
32 lines
1.0 KiB
PowerShell
# Quick fix script to update Backend service PYTHONPATH
|
|
# Run this as Administrator to fix the ModuleNotFoundError
|
|
|
|
param(
|
|
[string]$InstallPath = "C:\inetpub\wwwroot\roa2web",
|
|
[string]$ServiceName = "ROA2WEB-Backend"
|
|
)
|
|
|
|
Write-Host "Fixing Backend service PYTHONPATH..." -ForegroundColor Cyan
|
|
|
|
# Stop service
|
|
Write-Host "Stopping service..." -ForegroundColor Yellow
|
|
& nssm stop $ServiceName
|
|
Start-Sleep -Seconds 3
|
|
|
|
# Update PYTHONPATH to shared directory
|
|
$sharedPath = Join-Path $InstallPath "shared"
|
|
Write-Host "Setting PYTHONPATH to: $sharedPath" -ForegroundColor Yellow
|
|
& nssm set $ServiceName AppEnvironmentExtra "PYTHONPATH=$sharedPath"
|
|
|
|
# Start service
|
|
Write-Host "Starting service..." -ForegroundColor Yellow
|
|
& nssm start $ServiceName
|
|
Start-Sleep -Seconds 3
|
|
|
|
# Check status
|
|
Write-Host "`nChecking service status..." -ForegroundColor Cyan
|
|
& nssm status $ServiceName
|
|
|
|
Write-Host "`nDone! Check logs at: $InstallPath\logs\backend-stderr.log" -ForegroundColor Green
|
|
Write-Host "If errors persist, check the log file for details." -ForegroundColor Yellow
|