This project is a news classifier application that collects news articles from various RSS feeds, categorizes them, and stores them in a PostgreSQL database.
-
Install Dependencies:
pip install -r requirements.txt
-
Database Setup:
- Create a PostgreSQL database and update the
DATABASE_URL
inapp/database.py
.
- Create a PostgreSQL database and update the
-
Run the Application:
python run.py
-
Start Celery Worker:
celery -A app.celery_tasks worker --loglevel=info
-
Trigger Feed Parsing:
Access
http://localhost:5000/parse_feeds
to start parsing feeds.
Run the tests with:
```bash
python -m unittest discover tests/
```
Make sure to create the PostgreSQL database before running the application. The schema is created automatically when the application starts.
To run the application, ensure that Redis is running for Celery and PostgreSQL is set up properly.
-
Start Redis:
redis-server
-
Start PostgreSQL and create the database.
-
Run the application:
python run.py
-
In another terminal, start the Celery worker:
celery -A app.celery_tasks worker --loglevel=info
-
Access
http://localhost:5000/parse_feeds
to trigger the feed parsing.
This implementation provides a functional foundation for your news classifier application. You can further enhance the functionality, implement more robust error handling, and refine the classification logic as needed.