1.6 KiB
1.6 KiB
Starting the Python Service
Quick Start
cd backend/python_service
uvicorn main:app --reload --port 8010
Using Virtual Environment (Recommended)
If you want to use a virtual environment (recommended for isolation):
# Create virtual environment
cd backend/python_service
python -m venv venv
# Activate (Windows)
venv\Scripts\activate
# Activate (macOS/Linux)
source venv/bin/activate
# Install dependencies
pip install -r requirements.txt
# Start service
uvicorn main:app --reload --port 8010
Verify Service is Running
Once started, you should see:
INFO: Uvicorn running on http://127.0.0.1:8010
INFO: Application startup complete.
Test the health endpoint:
curl http://localhost:8010/health
Expected response:
{
"status": "healthy",
"service": "options-flow-processor"
}
Troubleshooting
ModuleNotFoundError
- Make sure you've run:
pip install -r requirements.txt - If using venv, make sure it's activated
- Check Python version:
python --version(should be 3.11+)
Port Already in Use
- Change port:
uvicorn main:app --reload --port 8001 - Update
PYTHON_SERVICE_URLin Node.js.envto match
Database Connection Error
- Check
.envfile has correct database credentials - Verify PostgreSQL is running
- Test connection:
psql -h localhost -U postgres -d institutional_trader
Next Steps
Once the Python service is running:
- Start Node.js backend:
cd backend && npm run dev - Node.js will automatically detect and use Python service
- Check logs to confirm:
✅ Using Python service