mirror of
https://github.com/thecyberlearn/chat-backend.git
synced 2026-08-18 21:12:52 +00:00
Features: - Django REST API backend - Multi-strategy web scraping system (Beautiful Soup, Playwright, Firecrawl) - Anti-detection features (proxy rotation, user-agent rotation) - Data export functionality (JSON, CSV, TXT) - Business and CrawledPage models - Enhanced crawling service with fallback mechanisms 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
19 lines
573 B
Python
19 lines
573 B
Python
from django.apps import apps
|
|
|
|
from .requests import RequestSite
|
|
|
|
|
|
def get_current_site(request):
|
|
"""
|
|
Check if contrib.sites is installed and return either the current
|
|
``Site`` object or a ``RequestSite`` object based on the request.
|
|
"""
|
|
# Import is inside the function because its point is to avoid importing the
|
|
# Site models when django.contrib.sites isn't installed.
|
|
if apps.is_installed("django.contrib.sites"):
|
|
from .models import Site
|
|
|
|
return Site.objects.get_current(request)
|
|
else:
|
|
return RequestSite(request)
|