We're looking for talented designers to create a brand identity and logo for Khadra!
If you'd like to contribute your design skills to our environmental cause, please reach out at:
π§ [email protected]
Your work will be seen by thousands of volunteers helping reforest Algeria!
Khadra is a Django-powered web application for an Algerian non-profit organization dedicated to reforesting Algeria. Our platform connects volunteers with tree-planting initiatives across the country, making it easy to participate in environmental restoration efforts.
- Manager Approval System: New initiatives require manager reviews before activation
- Role Promotion Workflow: Volunteers can request manager status, subject to approval by existing managers
- Review Period: 7-day voting window for both new initiatives AND role promotion requests
- Automated Evaluation System: Celery tasks handle:
- Initiative lifecycle transitions (status changes)
- Role promotion request evaluations
- Interactive Tree Map: Visualize planting locations using PostGIS spatial data
- Volunteer Dashboard: Track your contributions and upcoming events
- Real-time Notifications: Get alerts about new projects, role changes, and voting outcomes
- Project Participation: Join planting initiatives with one click
- Docker 20.10+
- Docker Compose 2.0+
# Clone the repository
git clone https://github.com/TonyXdZ/khadra.git
cd khadra
# Build and start all services
docker-compose up --build
# Access the application at:
http://localhost:8000After starting the containers:
# Create superuser (required for admin access)
docker-compose exec web python manage.py createsuperuser
# Collect static files (if not already done by entrypoint)
docker-compose exec web python manage.py collectstatic --no-inputThe system uses an entrypoint script that:
- Waits for PostgreSQL and Redis to become available
- Runs database migrations automatically
- Starts the Django application server
Here's what happens during startup:
[Entrypoint Script]
βββ Wait for PostgreSQL (db:5432) β
βββ Wait for Redis (redis:6379) β
βββ Run database migrations
βββ Start server (gunicorn)
- The entrypoint script automatically handles database migrations on every startup
- You only need to create a superuser once (first setup)
- Static files are collected automatically during build
- To stop the system:
docker-compose down
Khadra uses Celery for asynchronous task processing. Key tasks include:
- Manager Notification: Managers receive notifications when new initiatives are created
- 7-Day Review Period: Managers have 7 days to vote on new initiatives
- Approval Threshold: Requires minimum votes (
MIN_INITIATIVE_REVIEWS_REQUIRED) and majority approval
@shared_task
def evaluate_initiative_reviews_task(initiative_id):
"""
Evaluates initiative review outcomes after the 7-day review period
- Checks for minimum required reviews
- Tallys approve/reject votes
- Transitions status:
β’ 'review_failed' - Insufficient votes or majority rejection
β’ 'upcoming' - Approved by managers
- Sends approval/rejection notifications
- Schedules future status transitions
"""
...
@shared_task
def transition_initiative_to_ongoing_task(initiative_id):
"""
Transitions initiative to 'ongoing' status at scheduled start time
- Only transitions if status is 'upcoming'
- Sends initiative-started notifications
"""
...
@shared_task
def transition_initiative_to_completed_task(initiative_id):
"""
Transitions initiative to 'completed' status at calculated end time
- Handles both 'ongoing' and delayed 'upcoming' initiatives
- Sends completion notifications
"""
...[New Initiative Created]
β
[Notify Managers] β [7-Day Review Period]
β
evaluate_initiative_reviews_task()
βββ Approved β Status: 'upcoming'
β βββ Schedule β transition_initiative_to_ongoing_task()
β βββ Schedule β transition_initiative_to_completed_task()
β
βββ Rejected β Status: 'review_failed'
khadra/
βββ core/ # Main app with initiative management
β βββ tasks/ # Celery task definitions for initiatives
β βββ ... # Other core functionality
βββ users/ # User authentication & profiles
β βββ tasks/ # Celery task definitions for user management
β βββ ... # Other user functionality
βββ notifications/ # User notification system
βββ geodata/ # Spatial data and mapping functionality
βββ static/ # CSS, JS, and images
βββ templates/ # HTML templates
βββ manage.py
βββ Dockerfile
βββ docker-compose.yml
βββ requirements.txt
- Manager Approval: New initiatives require manager consensus
- Review Voting: Managers approve/reject during 7-day window
- Automated Transitions:
upcomingβongoingat scheduled start timeongoingβcompletedafter duration ends
- Status Tracking:
review_pending: Waiting for manager votesreview_failed: Rejected or insufficient votesupcoming: Approved, not yet startedongoing: Currently activecompleted: Finished initiative
- Role-Based Access:
- All new users start as
Volunteers - Volunteers can request manager status through promotion requests
- All new users start as
- Account Lifecycle:
- Volunteer signup with email verification
- (Future: Social login via Google/Facebook)
- Manager promotion workflow:
- Volunteer submits promotion request
- Existing managers vote during 7-day window
- Automated approval/rejection based on voting consensus
- Privileges:
- Volunteers: Participate in initiatives, track contributions
- Managers: Approve/reject new initiatives AND promotion requests
- Personalized dashboard showing:
- Participation history
- Current promotion request status
- Pending votes (for managers)
We welcome contributions from developers passionate about environmental conservation!
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a pull request
This project is licensed under the GNU Affero General Public License v3.0 - see the LICENSE file for details.
For inquiries about the project, partnership opportunities, or design contributions:
- Email: [email protected]
Together, let's make Algeria green again! π³π©πΏ