This project is a Django REST Framework (DRF) backend for a personalized news recommendation system. It provides APIs for managing users, articles, user preferences, and recommendations.
Follow these steps to set up the project:
-
Clone the repository:
git clone https://github.com/shahpankaj123/Personalized-News-Recommendation-System-Backend
-
Navigate to the project directory:
cd Personalized-News-Recommendation-System-Backend
-
Create a virtual environment (optional but recommended):
python3 -m venv venv
-
Activate the virtual environment:
- On Windows:
venv\Scripts\activate
- On macOS and Linux:
source venv/bin/activate
- On Windows:
-
Install dependencies:
pip install -r requirements.txt
-
Apply migrations:
python manage.py migrate
-
(Optional) Load initial data (e.g., sample articles):
python manage.py loaddata sample_data.json
-
Run the development server:
python manage.py runserver
- Database: This project uses MySQL. Ensure your MySQL database is set up and configured in
settings.py
. - Redis: Used for caching. Ensure Redis is installed and running on your machine.
- Celery: Used for sending emails and task scheduling.
- Broker: Redis is used as the message broker for Celery.
- Beat: Celery Beat is used for scheduling tasks.
-
Install Redis:
- On macOS:
brew install redis
- On Linux:
sudo apt-get install redis-server
- On Windows: Follow the instructions on the Redis website.
- On macOS:
-
Start Redis server:
redis-server
-
Add the following settings in your
settings.py
:# Celery Configuration Options CELERY_BROKER_URL = 'redis://localhost:6379/0' CELERY_RESULT_BACKEND = 'redis://localhost:6379/0' CELERY_ACCEPT_CONTENT = ['json'] CELERY_TASK_SERIALIZER = 'json' CELERY_RESULT_SERIALIZER = 'json' CELERY_TIMEZONE = 'UTC'
-
Start Celery worker and Beat in separate terminal windows:
# Start Celery worker celery -A your_project_name worker --loglevel=info # Start Celery Beat celery -A your_project_name beat --loglevel=info
Contributions are welcome! Feel free to open issues or pull requests for any improvements, bug fixes, or new features.
This project is licensed under the MIT License - see the LICENSE file for details.
This project is developed and maintained by: