Documentation Index
Fetch the complete documentation index at: https://mintlify.com/diegolozadev/DataMed/llms.txt
Use this file to discover all available pages before exploring further.
Deployment Guide
DataMed is designed for easy deployment to modern cloud platforms. This guide covers deployment to Render (recommended), Docker, and traditional hosting.Quick Deployment to Render
Render is the recommended platform for DataMed. The application includes pre-configured files for one-click deployment.Create Render Account
Sign up at render.com if you don’t have an account.
Create Web Service
- Click New → Web Service
- Connect your repository
- Render auto-detects Django settings
Configure Service
Set these values:
- Name:
datamed - Environment:
Python 3 - Build Command:
./build.sh - Start Command:
gunicorn config.wsgi
Add Environment Variables
Configure in Render dashboard:
SECRET_KEY: Generate withpython -c "from django.core.management.utils import get_random_secret_key; print(get_random_secret_key())"PYTHON_VERSION:3.11.0DATABASE_URL: Auto-populated if you add PostgreSQL
Add PostgreSQL Database
- Click New → PostgreSQL
- Name:
datamed-db - Link to your web service (auto-sets
DATABASE_URL)
Build Script
DataMed includesbuild.sh for automated deployment:
build.sh
set -o errexit: Stops on any error- Multiple migration attempts for reliability
- Verification logs for debugging
Procfile Configuration
TheProcfile defines how to run DataMed in production:
Procfile
migrate --noinput: Apply database migrations automaticallycollectstatic --noinput: Gather static files for WhiteNoisegunicorn config.wsgi: Start production WSGI server
Environment Configuration
Required Environment Variables
Django secret key for cryptographic operations. Must be unique and kept secret.Generate:
python -c "from django.core.management.utils import get_random_secret_key; print(get_random_secret_key())"PostgreSQL connection string. Automatically set by Render when you attach a database.Format:
postgresql://user:password@host:5432/databaseTriggers production mode when present (any value). Disables DEBUG and enables PostgreSQL.Value:
true or any non-empty stringProduction Settings Triggered by RENDER
WhenRENDER is set, DataMed automatically:
config/settings.py
Docker Deployment
Deploy DataMed using Docker for containerized environments.Dockerfile
Dockerfile
Docker Compose
docker-compose.yml
Running with Docker Compose
Traditional Server Deployment
Deploy to a VPS or dedicated server with Ubuntu/Debian.Post-Deployment Tasks
Monitoring and Logging
Application Logs
Gunicorn logs requests and errors:Health Checks
Implement health check endpoint:config/urls.py
Database Backups
Troubleshooting
Static Files Not Loading
Static Files Not Loading
Symptom: CSS/JS missing, pages unstyledSolution:
Database Connection Errors
Database Connection Errors
Symptom:
OperationalError: could not connect to serverSolution:- Verify
DATABASE_URLis set correctly - Check PostgreSQL is running:
sudo systemctl status postgresql - Test connection:
psql $DATABASE_URL
500 Internal Server Error
500 Internal Server Error
Symptom: Generic error pageSolution:
CSRF Verification Failed
CSRF Verification Failed
Symptom: Forms return CSRF errorSolution:
- Add your domain to
CSRF_TRUSTED_ORIGINSinsettings.py - Ensure you’re using HTTPS in production
Scaling Considerations
Horizontal Scaling
- Multiple Gunicorn Workers: Increase
--workersflag (typically2 * CPU_CORES + 1) - Load Balancer: Use Nginx or cloud load balancer for multiple application servers
- Database Connection Pooling: Consider PgBouncer for high traffic
Vertical Scaling
- Render: Upgrade to higher-tier plan for more RAM/CPU
- VPS: Resize instance or migrate to more powerful server
Caching
Add Redis caching for improved performance:settings.py
Next Steps
Configuration
Fine-tune environment and security settings
Database Schema
Understand the data model
Backup & Restore
Implement backup strategies
User Management
Create and manage user accounts