NewLoom is a comprehensive news monitoring, aggregation, and publishing platform built with Django. It provides a robust system for:
- News Monitoring: Automated tracking of multiple news sources through various channels
- Content Aggregation: Intelligent scraping and parsing of news content from diverse sources
- Content Processing: Customizable processing pipelines for content transformation
- Multi-Channel Publishing: Automated distribution of processed content to various platforms
NewLoom is built on three main pillars:
-
Django Backend
- Core data models and business logic
- REST API endpoints using Django REST framework
- WebSocket support via Django Channels
- Admin interface for configuration
-
Stream Scheduler
- Custom task scheduling and execution
- Configurable processing pipelines
- Error handling and retry mechanisms
- Execution statistics tracking
-
Integration Layer
- Playwright for JavaScript-heavy websites
- Telegram API integration
- Slack bot integration
- Articlean content processing
- Python 3.8+
- Django 5.1.3
- PostgreSQL (recommended) or SQLite
- Playwright
- Additional requirements:
- Django Channels (for WebSocket support)
- Django REST framework (for API endpoints)
- Django CORS headers (for cross-origin support)
- Multiple source type support (Web, Telegram, RSS, etc.)
- Real-time WebSocket communication
- RESTful API endpoints
- Configurable stream scheduling
- Built-in task scheduling and execution
- Playwright support for JavaScript-heavy websites
- Automatic content extraction and storage
-
Clone the repository:
git clone https://github.com/rimamedia/newsloom.git cd newsloom -
Create and activate a virtual environment:
python -m venv venv source venv/bin/activate # Unix venv\Scripts\activate # Windows
-
Install required packages:
pip install -r requirements.txt
-
Install Playwright browsers:
playwright install
-
Set up environment variables:
cp .env.example .env # Edit .env with your configuration -
Run migrations:
python manage.py migrate
-
Create a superuser:
python manage.py createsuperuser
-
Collect static files:
python manage.py collectstatic
Copy .env.example to .env and configure:
-
Django Settings:
- DJANGO_SECRET_KEY
- DEBUG
- ALLOWED_HOSTS
-
Database Configuration:
- DB_NAME
- DB_USER
- DB_PASSWORD
- DB_HOST
- DB_PORT
-
Security Settings:
- CSRF_TRUSTED_ORIGINS
- CSRF_COOKIE_SECURE
- CSRF_USE_SESSIONS
-
Integration Settings (as needed):
- AWS credentials
- Articlean API settings
- Slack/Telegram tokens
-
Add allowed origins in settings.py or .env:
CORS_ALLOWED_ORIGINS = [ "http://localhost:8000", "http://127.0.0.1:8000", ]
-
Configure CORS middleware:
MIDDLEWARE = [ 'corsheaders.middleware.CorsMiddleware', # ... other middleware ]
-
Start the Django development server:
python manage.py runserver
-
Start the stream scheduler:
python manage.py run_streams
The API documentation is available at:
- Swagger UI:
/api/docs/ - ReDoc:
/api/redoc/
Authentication is required for most endpoints using:
- Token Authentication
- Session Authentication
WebSocket endpoints are available for real-time updates:
- Chat:
ws://localhost:8000/ws/chat/ - Stream Status:
ws://localhost:8000/ws/streams/
-
Build and start containers:
docker-compose up -d --build
This will:
- Build the Docker image
- Run collectstatic automatically
- Configure Nginx to serve static files
- Mount volumes for static and media files
-
Verify static files setup:
docker-compose exec web ls /app/staticfiles -
Create superuser in container:
docker-compose exec web python manage.py createsuperuser
Note: Static and media files are managed through Docker volumes for persistence. The project uses Nginx to serve these files efficiently in both development and production environments.
- Access the Django admin interface at http://localhost:8000/admin
- Go to "Sources" section
- Click "Add Source"
- Fill in the required fields:
- Name
- Link (main website URL)
- Type (Web, Telegram, RSS, etc.)
- In the Django admin, go to "Streams" section
- Click "Add Stream"
- Configure the stream:
- Name
- Stream Type
- Source
- Frequency
- Configuration (JSON format)
- Failed tasks are automatically logged
- Configurable retry mechanisms
- Detailed error reporting in admin interface
- Stream execution statistics tracking
- Set DEBUG=False in production
- Configure proper CORS settings
- Use HTTPS in production
- Set secure cookie settings
- Configure CSRF protection
- Use environment variables for sensitive data
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature) - Commit your Changes (
git commit -m 'Add some AmazingFeature') - Push to the Branch (
git push origin feature/AmazingFeature) - Open a Pull Request
MIT License - see LICENSE file for details
RimaMedia - @rimamedia
Project Link: https://github.com/rimamedia/newsloom