Skip to main content
This guide walks you through the complete setup process for FKApi, from installing dependencies to running your first API requests.

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

Expected response:

Test API Endpoints

Production Configuration

For production deployments, update your .env file:
Important Security Notes:
  • Never commit .env files to version control
  • Generate a strong DJANGO_SECRET_KEY using python -c "from django.core.management.utils import get_random_secret_key; print(get_random_secret_key())"
  • Always set DEBUG=False in production
  • Use strong, unique passwords for database access
  • Configure HTTPS/SSL for production deployments

Running with Gunicorn (Production)

For production, use Gunicorn instead of the development server:
Gunicorn configuration:
  • --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:
  1. Verify PostgreSQL is running: sudo systemctl status postgresql (Linux) or pg_ctl status (Windows)
  2. Check database credentials in .env
  3. Ensure database exists: psql -U postgres -l
  4. Check PostgreSQL is listening on the correct port: netstat -an | grep 5432

Module Import Errors

If you see ModuleNotFoundError:
  1. Ensure virtual environment is activated
  2. Reinstall requirements: pip install -r requirements.txt
  3. Verify Python version: python --version (should be 3.10+)

Port Already in Use

If port 8000 is already in use:
  1. Change port in .env: DJANGO_PORT=8001
  2. Or run with custom port: python manage.py runserver 8001
  3. Find and kill process using port: lsof -ti:8000 | xargs kill (Linux/Mac)

Permission Errors

On Linux/Mac, you may need to:

Environment Variables Reference

Additional Resources