Baby Tracker Setup Guide
Step-by-step instructions for setting up the Baby Tracker development environment
Developer Setup
Get up and running with Baby Tracker in minutes
Prerequisites
- Python 3.9+
- PostgreSQL 12+ (or use Docker)
- Git
- Docker & Docker Compose (optional, for containerized setup)
Quick Start with Docker (Recommended)
The easiest way to get started is using Docker Compose, which includes PostgreSQL and all dependencies.
1. Clone and start the application
# Clone the repository
git clone https://github.com/theamazingmrb/baby-tracker-api.git
cd baby-tracker-api
# Start all services
docker-compose up -d
2. Initialize the database
# Run migrations
docker-compose exec web python manage.py migrate
# Create admin user
docker-compose exec web python manage.py createsuperuser
# Load demo data (optional)
docker-compose exec web python manage.py loaddata demo_data.json
Local Development Setup
For local development without Docker, follow these steps:
1. Clone and setup Python environment
git clone https://github.com/theamazingmrb/baby-tracker-api.git
cd baby-tracker-api
# Create virtual environment
python -m venv venv
source venv/bin/activate # On Windows: venv\\Scripts\\activate
# Install dependencies
pip install -r requirements.txt
2. Configure environment variables
# Copy environment template
cp .env.example .env
Important: Edit the .env file with your database credentials and other settings.
3. Setup PostgreSQL database
# Create database (adjust for your PostgreSQL setup)
createdb babytracker
# Run migrations
python manage.py migrate
# Create admin user
python manage.py createsuperuser
# Start development server
python manage.py runserver
Environment Variables
Key environment variables you need to configure:
| Variable | Description | Example |
|---|---|---|
| DJANGO_DEBUG | Enable debug mode | True |
| SECRET_KEY | Django secret key | your-secret-key-here |
| ENVIRONMENT | Environment type | development |
| NETWORK_HOST | Host to bind the Django server to | 0.0.0.0 |
| NETWORK_PORT | Port for the Django server | 8000 |
| WEB_PORT | Port to expose the web service on host | 80 |
| ALLOWED_HOSTS | Comma-separated list of allowed host names | localhost,127.0.0.1,0.0.0.0 |
| PRODUCTION_DOMAIN | Your API backend domain | example.com |
| FRONTEND_DOMAIN | Your frontend application domain | example.com |
| CORS_ALLOW_ALL_ORIGINS | Allow all origins for CORS | True |
| CORS_ALLOWED_ORIGINS | Comma-separated list of allowed origins | http://localhost:3000 |
| DATABASE_URL | Database connection string | postgresql://user:pass@localhost/babytracker |
| POSTGRES_USER | PostgreSQL username (Docker) | postgres |
| POSTGRES_PASSWORD | PostgreSQL password (Docker) | postgres |
| POSTGRES_DB | PostgreSQL database name (Docker) | baby_tracker |
| EMAIL_BACKEND | Django email backend | django.core.mail.backends.smtp.EmailBackend |
| EMAIL_HOST | SMTP server hostname | smtp.gmail.com |
| EMAIL_PORT | SMTP server port | 587 |
| EMAIL_USE_TLS | Use TLS for email | True |
| EMAIL_HOST_USER | Email username | your-email@example.com |
| EMAIL_HOST_PASSWORD | Email password | your-email-password |
| AWS_ACCESS_KEY_ID | AWS access key (for S3/EB) | your-access-key |
| AWS_SECRET_ACCESS_KEY | AWS secret key (for S3/EB) | your-secret-key |
| AWS_STORAGE_BUCKET_NAME | AWS S3 bucket name | your-bucket-name |
| AWS_S3_REGION_NAME | AWS region | us-west-2 |
Testing the API
Once the server is running, you can test the API endpoints:
Using curl
# Register a new user
curl -X POST http://localhost:80/api/tracker/register/ \
-H "Content-Type: application/json" \\\
-d '{
"username": "testuser",
"email": "test@example.com",
"password": "testpass123"
}'
Using Python requests
import
requests
response = requests.post(
"http://localhost:80/api/tracker/register/",
json={
"username": "testuser",
"email": "test@example.com",
"password": "testpass123"
}
)
📚 Next Steps
- • Explore the API Documentation in detail
- • Check out the interactive Swagger UI for API testing
- • View API schema in ReDoc format
- • Review the Contributing Guidelines
- • Access the Django Admin interface
- • View the GitHub Repository