A modernized Django-based news aggregation application that scrapes and displays news from Inshorts.com in both English and Hindi, featuring a sleek dark theme and professional UI/UX.
Visit the live application: https://quicknews.karanjot.co.in
Deployed using Docker containers and hosted on Cloudflare for optimal performance and reliability.
This project started as my first Django project during college in 2021 and has been completely revamped with modern web development practices. It showcases the evolution from a learning project to a production-ready application with professional-grade features.
Original Project (2021): The original Django News application can be found at:
- π Old Repository: https://github.com/Karanjot786/Django-News
- This repository contains the legacy codebase from my college days
Current Version (2025): This repository represents a complete modernization with:
- Complete UI/UX redesign with professional dark theme
- Refactored codebase using modern Django practices
- Enhanced features and performance optimizations
- Production-ready code with comprehensive error handling
Note: Compare the old and new versions to see the evolution in code quality, design patterns, and feature implementation!
- β Modern Dark Theme UI - Professional dark interface with smooth transitions
- β Interactive Modal Dialogs - Click any article to read full content in a beautiful modal
- β Optimized Scraping - Enhanced error handling and duplicate prevention
- β Smart Sorting - Articles sorted by publication date (newest first)
- β Infinite Scroll - Seamless content loading as you scroll
- β Category Filtering - Filter news by political leaning (left/center/right)
- β View Modes - Toggle between grid and list layouts
- β Share Functionality - Easy article sharing with native browser API
- β Responsive Design - Fully optimized for mobile, tablet, and desktop
- β Performance Optimized - Lazy loading, efficient database queries, and caching
- β Docker Deployment - Containerized for easy deployment and scaling
- β Production Ready - Live at quicknews.karanjot.co.in hosted on Cloudflare
- π° Real-time News Scraping - Fetches latest articles from Inshorts.com
- π Bilingual Support - Full support for English and Hindi content
- π Auto-refresh - Smart caching with automatic updates
- π― 10 News Categories:
- General News
- Business
- National (India)
- Sports
- World News
- Politics
- Technology
- Startup
- Entertainment
- Miscellaneous
- π¨ Professional Dark Theme - Eye-friendly dark mode with CSS custom properties
- π± Fully Responsive - Seamless experience across all devices
- πΌοΈ Article Modals - Click any article to view in an elegant dialog
- π Quick Categories - Sticky navigation for fast category switching
- π Dual View Modes - Switch between grid and list layouts
- π·οΈ Political Leaning Filter - Filter by left, center, or right leaning sources
- βΎοΈ Infinite Scroll - Load more articles automatically as you scroll
- β‘ Smooth Animations - Professional transitions and hover effects
- π‘οΈ Duplicate Prevention - Intelligent article deduplication
- π Date-based Sorting - Articles sorted by publication date
- πΎ Smart Caching - Efficient data storage and retrieval
- π« Error Resilience - Comprehensive error handling for scraping
- π SEO Optimized - Proper meta tags and semantic HTML
- Django 5.2.7 - Modern Python web framework
- Python 3.8+ - Core programming language
- SQLite - Database for article storage
- Class-based Views - Modern Django ListView implementation
- BeautifulSoup4 4.14.2 - HTML parsing
- Requests 2.32.5 - HTTP library
- lxml 6.0.2 - Fast XML/HTML parser
- Tailwind CSS (CDN) - Utility-first CSS framework
- Vanilla JavaScript - Interactive features and modal dialogs
- Font Awesome - Icon library
- CSS Custom Properties - Dynamic theming system
- Intersection Observer API - Infinite scroll implementation
- Docker - Containerization for consistent deployments
- Cloudflare - Hosting and CDN for optimal performance
- Gunicorn - Production WSGI server
- WhiteNoise - Static file serving
Django==5.2.7
beautifulsoup4==4.14.2
bs4==0.0.2
requests==2.32.5
lxml==6.0.2
QuickNews/
βββ DjangoNews/ # Main Django project configuration
β βββ settings.py # Development settings
β βββ settings_production.py # Production settings
β βββ urls.py # Root URL routing
β βββ wsgi.py # WSGI configuration
βββ news/ # Core news application
β βββ models.py # Headline database model
β βββ views_new.py # Modern class-based views
β βββ urls_new.py # URL patterns for new views
β βββ scraper.py # Unified scraping logic
β βββ getnews/ # Legacy scraping modules
β βββ getnews.py # Category orchestration
β βββ news_sites/ # Site-specific scrapers
β βββ getcbs.py # English news scraper
β βββ gethindi.py # Hindi news scraper
βββ templates/ # Django templates
β βββ base.html # Base template with navigation
β βββ news/ # English templates
β β βββ news.html # Main English news page
β βββ hindinews/ # Hindi templates
β βββ news.html # Main Hindi news page
βββ static/ # Static assets
β βββ images/ # Screenshot assets
β βββ new/ # Current version screenshots
β β βββ en/ # English screenshots
β β βββ hi/ # Hindi screenshots
β βββ old/ # Legacy screenshots
βββ Dockerfile # Docker configuration
βββ .dockerignore # Docker ignore patterns
βββ requirements.txt # Python dependencies
βββ DEPLOYMENT.md # Deployment guide
βββ QUICKSTART_DEPLOYMENT.md # Quick deployment instructions
βββ manage.py # Django CLI tool
- Python 3.8 or higher
- pip (Python package installer)
- Clone the repository
git clone https://github.com/Karanjot786/Django-News.git
cd new_Django_News- Create and activate virtual environment (recommended)
python3 -m venv env
source env/bin/activate # On Windows: env\Scripts\activate- Install dependencies
pip install Django==5.2.7 beautifulsoup4==4.14.2 bs4==0.0.2 requests==2.32.5 lxml==6.0.2
# Or use: pip install -r requirements.txt- Run database migrations
python3 manage.py makemigrations
python3 manage.py migrate- Create a superuser (optional - for admin access)
python3 manage.py createsuperuser- Start the development server
python3 manage.py runserver- Access the application
- English News:
http://127.0.0.1:8000/ - Hindi News:
http://127.0.0.1:8000/hindi/ - Admin Panel:
http://127.0.0.1:8000/admin/(if superuser created) - Specific Category:
http://127.0.0.1:8000/technology/orhttp://127.0.0.1:8000/hindi/sports/
- English News:
The application is containerized using Docker for easy deployment and scalability.
- Build the Docker image
docker build -t quicknews .- Run the container
docker run -p 8000:8000 quicknews- Using Docker Compose (recommended)
docker-compose up -dThe live application at https://quicknews.karanjot.co.in is deployed using:
- Docker Containers: Ensures consistent environment across development and production
- Cloudflare Hosting: Provides:
- Global CDN for fast content delivery
- DDoS protection and security
- SSL/TLS encryption
- DNS management
- Performance optimization
For detailed deployment instructions, see DEPLOYMENT.md and QUICKSTART_DEPLOYMENT.md.
Modern dark theme homepage with grid layout and featured articles
Interactive modal dialog showing full article content
Hindi news homepage with professional dark theme
Hindi article modal with full content and sharing options
Want to see how far we've come? Check out the original version:
- π Screenshots available in
static/images/old/ - π Original repository: Django-News (2021)
Key Differences:
| Feature | Old Version (2021) | New Version (2025) |
|---|---|---|
| UI Theme | Light theme, basic styling | Professional dark theme |
| Layout | Simple list view | Grid/List toggle, featured articles |
| Article View | Opens in new tab | Interactive modal dialog |
| Navigation | Basic navbar | Sticky categories, quick filters |
| Mobile Support | Limited responsive | Fully responsive with touch support |
| Performance | Direct scraping on load | Smart caching, infinite scroll |
| Code Structure | Function-based views | Class-based views, modular design |
| Deployment | Basic server setup | Docker containers on Cloudflare |
| Production | Not deployed | Live at quicknews.karanjot.co.in |
If you're coming from the old Django-News repository, here's what you need to know:
The database schema is compatible, but you'll need to:
- Export your existing data (if any) using Django's
dumpdatacommand - Set up the new repository following installation steps above
- Import data using Django's
loaddatacommand
- Views: Migrated from function-based (
views.py) to class-based (views_new.py) - Scraping: Consolidated scraping logic in new
scraper.py - Templates: Completely redesigned with dark theme in
templates/news/news.htmlandtemplates/hindinews/news.html - URLs: New routing in
urls_new.pyalongside legacyurls.py
All features from the old version are available, plus:
- β¨ Modal dialogs for article reading
- β¨ Infinite scroll pagination
- β¨ Political leaning filters
- β¨ Grid/List view toggle
- β¨ Smart caching and duplicate prevention
- β¨ Date-based sorting
- Homepage: Visit the root URL to see general English news
- Category Selection: Click on any category in the navigation bar
- Language Toggle: Use the language switcher to toggle between English and Hindi
- Article Reading: Click on any article card to open it in a modal dialog
- Infinite Scroll: Scroll down to automatically load more articles
- Filter News: Use the leaning filter buttons to filter by political perspective
- View Modes: Toggle between grid and list view using the view buttons
- Share Articles: Click the share button to share articles via browser's native share API
- Smart Caching: Articles are cached in the database to reduce scraping
- Auto-refresh: New articles are fetched when visiting a category
- Duplicate Prevention: System automatically prevents duplicate articles from being stored
- Date Sorting: Articles are displayed with newest first
Access the admin panel at /admin/ to:
- View all stored headlines
- Manually add/edit/delete articles
- Monitor database contents
- Manage categories
- β Complete UI Overhaul: Migrated from old design to modern dark theme
- β Class-based Views: Refactored from function-based to modern ListView
- β
Unified Scraper: Created new
scraper.pywith consolidated logic - β Modal Dialogs: Added interactive article reading experience
- β Performance: Implemented pagination, lazy loading, and efficient queries
- β Duplicate Prevention: Smart duplicate detection by title
- β Date Sorting: Articles now sorted by publication date
- β Error Handling: Comprehensive error handling throughout scraping pipeline
- β Responsive Design: Full mobile, tablet, and desktop optimization
- β SEO: Added proper meta tags and semantic HTML
- β Docker Deployment: Containerized application for consistent deployments
- β Production Launch: Deployed live at quicknews.karanjot.co.in on Cloudflare
- Fixed AttributeError issues in web scraping functions
- Resolved pagination duplicates
- Fixed favicon.ico routing issue
- Prevented article deletion on refresh
- Enhanced error resilience for missing HTML elements
class Headline(models.Model):
leaning = models.TextField() # 'left', 'center', or 'right'
title = models.TextField()
img = models.URLField(max_length=1000, null=True, blank=True)
content = models.TextField()
date = models.TextField(null=True)
url = models.URLField(max_length=1000)
language = models.CharField(max_length=2) # 'en' or 'hi'
category = models.CharField(max_length=50)
created_at = models.DateTimeField(auto_now_add=True)GET /- English general newsGET /<category>/- English category news (business, sports, etc.)GET /hindi/- Hindi general newsGET /hindi/<category>/- Hindi category newsGET /api/load-more/- AJAX endpoint for paginationGET /admin/- Django admin panel
- User visits a category page
- View checks database for recent articles (within cache time)
- If needed, scraper fetches latest articles from Inshorts.com
- Articles are parsed, deduplicated, and saved to database
- View retrieves articles, sorts by date, and renders template
- Frontend displays articles with infinite scroll
We welcome contributions! Here's how you can help:
- Fork the repository
- Create a feature branch
git checkout -b feature/amazing-feature
- Make your changes
- Follow PEP 8 style guide for Python code
- Add comments for complex logic
- Test your changes thoroughly
- Commit your changes
git commit -m 'Add amazing feature' - Push to your branch
git push origin feature/amazing-feature
- Open a Pull Request
- π Bug fixes
- β¨ New features (e.g., user authentication, bookmarks)
- π Documentation improvements
- π¨ UI/UX enhancements
- π Additional language support
- π§ͺ Testing improvements
This project is open source and available under the MIT License.
- Always respect the website's
robots.txtand terms of service - Implement rate limiting to avoid overloading the source website
- Do not use scraped content for commercial purposes without permission
- Be mindful of copyright and intellectual property rights
- Inshorts - For providing concise news content
- Django Community - For the amazing web framework
- BeautifulSoup - For making web scraping accessible
- Tailwind CSS - For the utility-first CSS framework
- Developer: Karanjot Singh
- GitHub: @Karanjot786
- Current Project: QuickNews (2025 Modernized Version)
- Legacy Project: Django-News (2021) - Original college project
| Version | Repository | Description |
|---|---|---|
| π New (2025) | This repository | Modern QuickNews with dark theme, modals, and optimizations |
| π Old (2021) | Django-News | Original college project showcasing learning journey |
β If you found this project helpful, please consider giving it a star on both repositories to see the evolution!
- β Star this repository if you like the modernized version
- π Check the old repository to see how far the project has evolved
- π Report issues if you find any bugs
- π‘ Suggest features for future improvements
- π€ Contribute by submitting pull requests