A carpooling application that helps users find and share rides easily.
- User Authentication (Drivers and Riders)
- Profile Management
- Ride Management
- Route Matching using geopy
- Rating System
- Interactive Maps
- Real-time Notifications
- Backend: Django + Django REST Framework
- Database: PostgreSQL
- Geolocation: geopy
- Authentication: JWT tokens
- Python 3.8+
- PostgreSQL
- Virtual Environment
- Clone the repository:
git clone <repository-url>
cd carpool-system- Create and activate virtual environment:
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate- Install dependencies:
pip install -r requirements.txt- Create a
.envfile in the project root with the following variables:
DEBUG=True
SECRET_KEY=your-secret-key-here
DATABASE_URL=postgres://user:password@localhost:5432/carpool_db
ALLOWED_HOSTS=localhost,127.0.0.1
GEOCODING_API_KEY=your-geocoding-api-key
MAPBOX_ACCESS_TOKEN=your-mapbox-token
- Create the database:
createdb carpool_db- Apply migrations:
python manage.py migrate- Create a superuser:
python manage.py createsuperuserpython manage.py runserverThe API will be available at http://localhost:8002/api/
POST /api/auth/token/: Obtain JWT tokenPOST /api/auth/token/refresh/: Refresh JWT token
GET /api/users/: List usersPOST /api/users/: Register new userGET /api/users/me/: Get current user profilePUT /api/users/update_profile/: Update user profilePOST /api/users/{id}/rate_user/: Rate a userGET /api/users/{id}/ratings/: Get user ratings
GET /api/rides/: List ridesPOST /api/rides/: Create new rideGET /api/rides/search/: Search ridesPOST /api/rides/{id}/update_status/: Update ride statusGET /api/rides/{id}/: Get ride details
GET /api/ride-requests/: List ride requestsPOST /api/ride-requests/: Create ride requestPOST /api/ride-requests/{id}/update_status/: Update request status
- Fork the repository
- Create your feature branch
- Commit your changes
- Push to the branch
- Create a Pull Request
This project is licensed under the MIT License.
To ensure that ride statuses are updated automatically (marking expired pending requests and completed rides), you should set up a cron job or a scheduled task to run the following command at regular intervals (e.g., every 15 minutes):
python manage.py process_ride_statuses
Add this to your crontab by running crontab -e and adding:
*/15 * * * * cd /path/to/your/project && /path/to/your/venv/bin/python manage.py process_ride_statuses >> /path/to/logfile.log 2>&1
Create a batch file with:
@echo off
cd C:\path\to\your\project
C:\path\to\your\venv\Scripts\python.exe manage.py process_ride_statusesThen set up a scheduled task to run this batch file every 15 minutes.