A clean and simple news aggregator web application built with Python and Flask that fetches and displays the latest articles on Artificial Intelligence and technology.
- Live News: Fetches the latest AI and tech news in real-time from the NewsAPI.
- Clean UI: A modern, responsive user interface built with Bootstrap 5.
- Secure API Handling: Uses environment variables to securely manage API keys.
- Production Ready: Includes a
gunicorn
setup for easy deployment.
- Backend: Python, Flask
- Frontend: HTML, Bootstrap 5
- API: NewsAPI.org
- Deployment: Gunicorn, Render (or any other platform)
To run this project locally, follow these steps:
-
Clone the repository:
git clone [https://github.com/dev-KartikSharma/AI-News.git](https://github.com/dev-KartikSharma/AI-News.git) cd AI-News
-
Create and activate a virtual environment:
# For Windows python -m venv env .\env\Scripts\activate # For macOS/Linux python3 -m venv env source env/bin/activate
-
Install the required dependencies:
pip install -r requirements.txt
-
Create a
.env
file: Create a file named.env
in the root of the project folder and add your NewsAPI key to it. You can get a free key from newsapi.org.NEWS_API_KEY="your_secret_api_key_goes_here"
-
Run the application:
flask run
Open your web browser and navigate to
http://127.0.0.1:5000/
.
This application is ready for deployment. It was successfully deployed using Render.
- Build Command:
pip install -r requirements.txt
- Start Command:
gunicorn app:app
Remember to set the NEWS_API_KEY
as an environment variable in your hosting service's dashboard.