Prerequisites
Before you begin, ensure you have the following installed:- Python 3.10 or higher
- PostgreSQL 15 or higher
- Git
- pip and virtualenv
System Requirements
- OS: Windows, Linux, or macOS
- RAM: Minimum 4GB (8GB recommended)
- Storage: 1GB for application and dependencies
- Network: Internet connection for initial data scraping
Installation
Verification
Verify your installation by testing these endpoints:Health Check
Test API Endpoints
Production Configuration
For production deployments, update your.env file:
Running with Gunicorn (Production)
For production, use Gunicorn instead of the development server:--workers 4: Number of worker processes (recommended: 2-4 x CPU cores)--timeout 120: Worker timeout in seconds--bind 0.0.0.0:8000: Bind to all interfaces on port 8000
Next Steps
Docker Deployment
Deploy FKApi using Docker and docker-compose
Celery Setup
Configure async tasks with Celery
Caching Strategy
Optimize performance with Redis caching
Monitoring
Set up Prometheus and Grafana monitoring
Troubleshooting
Database Connection Errors
If you see connection errors:- Verify PostgreSQL is running:
sudo systemctl status postgresql(Linux) orpg_ctl status(Windows) - Check database credentials in
.env - Ensure database exists:
psql -U postgres -l - Check PostgreSQL is listening on the correct port:
netstat -an | grep 5432
Module Import Errors
If you seeModuleNotFoundError:
- Ensure virtual environment is activated
- Reinstall requirements:
pip install -r requirements.txt - Verify Python version:
python --version(should be 3.10+)
Port Already in Use
If port 8000 is already in use:- Change port in
.env:DJANGO_PORT=8001 - Or run with custom port:
python manage.py runserver 8001 - Find and kill process using port:
lsof -ti:8000 | xargs kill(Linux/Mac)