Django-powered API for CRADLE
Explore main project »
Django-based backend providing core functionality for CRADLE including:
- REST API endpoints
- Data models and PostgreSQL integration
- File storage with MinIO
- Authentication system
- Background task processing with Celery and Redis
- Python 3.11+
- PostgreSQL 13+
- Redis 6.0+
- Pipenv
- MinIO (optional)
-
Clone the repository
git clone https://github.com/prodaft/cradle.git cd cradle/backend git submodule update --init --recursive -
Database Setup
psql -U [your-postgres-username] CREATE DATABASE cradledb; -
Redis Setup
- Install and start Redis server
# On Ubuntu sudo apt install redis-server sudo systemctl start redis -
Configure Environment
- Update database credentials in
cradle/settings.py
DATABASES = { 'default': { 'ENGINE': 'django.db.backends.postgresql', 'NAME': 'cradledb', 'USER': '[your_user]', 'PASSWORD': '[your_password]', 'HOST': 'localhost', 'PORT': '5432', } } CELERY_BROKER_URL = 'redis://localhost:6379/0'
- Update database credentials in
-
Install Dependencies
pip install pipenv pipenv install
-
Run Migrations
pipenv run python manage.py migrate
-
Start Services
# Start Django development server pipenv run python manage.py runserver # Start Celery worker (in separate terminal) pipenv run celery -A cradle worker -Q email,notes,publish,import -l INFO
# Run tests
pipenv run python manage.py test
# Create new migration
pipenv run python manage.py makemigrations
# Generate API documentation
cd docs && make html
# Monitor Celery tasks
pipenv run celery -A cradle flower# Access Django shell
pipenv run python manage.py shell_plus --ipython
# Check code quality
pipenv run flake8 .Database Connection Issues
- Verify PostgreSQL service is running
- Check credentials in settings.py match your DB configuration
Celery Task Issues
- Ensure Redis server is running
- Verify Celery worker is started
- Check task queue status with Flower
See main project contribution guidelines. For backend-specific issues:
- Fork & create feature branch
- Commit changes with descriptive messages
- Open pull request with test coverage details
Distributed under the MIT License. See LICENSE for details.