mirror of
https://github.com/thecyberlearn/chat-backend.git
synced 2026-08-18 08:52:54 +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>
59 lines
2.7 KiB
Python
59 lines
2.7 KiB
Python
# Generated by Django 5.2.6 on 2025-09-20 19:00
|
|
|
|
import django.db.models.deletion
|
|
from django.conf import settings
|
|
from django.db import migrations, models
|
|
|
|
|
|
class Migration(migrations.Migration):
|
|
|
|
initial = True
|
|
|
|
dependencies = [
|
|
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
|
|
]
|
|
|
|
operations = [
|
|
migrations.CreateModel(
|
|
name='Business',
|
|
fields=[
|
|
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
|
('name', models.CharField(max_length=200)),
|
|
('website_url', models.URLField(help_text='Main website URL to crawl')),
|
|
('description', models.TextField(blank=True)),
|
|
('industry', models.CharField(blank=True, max_length=100)),
|
|
('status', models.CharField(choices=[('setup', 'Setup'), ('crawling', 'Crawling'), ('completed', 'Completed'), ('failed', 'Failed')], default='setup', max_length=20)),
|
|
('created_at', models.DateTimeField(auto_now_add=True)),
|
|
('updated_at', models.DateTimeField(auto_now=True)),
|
|
('primary_color', models.CharField(default='#3b82f6', max_length=7)),
|
|
('secondary_color', models.CharField(default='#1e40af', max_length=7)),
|
|
('logo_url', models.URLField(blank=True)),
|
|
('ai_personality', models.CharField(default='professional and helpful', max_length=200)),
|
|
('welcome_message', models.TextField(blank=True)),
|
|
('created_by', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
|
|
],
|
|
options={
|
|
'verbose_name_plural': 'Businesses',
|
|
'ordering': ['-created_at'],
|
|
},
|
|
),
|
|
migrations.CreateModel(
|
|
name='CrawledPage',
|
|
fields=[
|
|
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
|
('url', models.URLField()),
|
|
('title', models.CharField(blank=True, max_length=500)),
|
|
('description', models.TextField(blank=True)),
|
|
('content', models.TextField()),
|
|
('crawled_at', models.DateTimeField(auto_now_add=True)),
|
|
('success', models.BooleanField(default=True)),
|
|
('error_message', models.TextField(blank=True)),
|
|
('business', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='pages', to='scraping.business')),
|
|
],
|
|
options={
|
|
'ordering': ['-crawled_at'],
|
|
'unique_together': {('business', 'url')},
|
|
},
|
|
),
|
|
]
|