Add management command to seed comprehensive sample data for ThrillWiki application

- Implemented cleanup of existing sample data to avoid conflicts.
- Created functions to generate companies, parks, rides, park areas, and reviews.
- Ensured proper relationships between models during data creation.
- Added logging for better tracking of data seeding process.
- Included checks for required database tables before seeding.
This commit is contained in:
pacnpal
2025-08-20 10:16:21 -04:00
parent 641fc1a253
commit 78248aa892
11 changed files with 1489 additions and 64 deletions

View File

@@ -43,6 +43,8 @@ INSTALLED_APPS = [
"whitenoise",
"django_tailwind_cli",
"autocomplete", # Django HTMX Autocomplete
"debug_toolbar",
"silk",
"core",
"accounts",
"parks",
@@ -57,6 +59,7 @@ MIDDLEWARE = [
"django.middleware.cache.UpdateCacheMiddleware",
"django.middleware.security.SecurityMiddleware",
"whitenoise.middleware.WhiteNoiseMiddleware",
"debug_toolbar.middleware.DebugToolbarMiddleware",
"django.contrib.sessions.middleware.SessionMiddleware",
"django.middleware.common.CommonMiddleware",
"django.middleware.csrf.CsrfViewMiddleware",
@@ -93,21 +96,19 @@ WSGI_APPLICATION = "thrillwiki.wsgi.application"
# Database
# Parse database URL but force PostGIS engine
db_config = dj_database_url.config(
default="[DATABASE-URL-REMOVED]
conn_max_age=600,
conn_health_checks=True,
)
# Force PostGIS engine - override any parsed engine
# For development, use PostgreSQL with PostGIS for GeoDjango features
DATABASES = {
"default": {
**db_config,
"ENGINE": "django.contrib.gis.db.backends.postgis",
"NAME": "thrillwiki",
"USER": "postgres",
"PASSWORD": "postgres",
"HOST": "localhost",
"PORT": "5432",
}
}
# Cache settings
CACHES = {
"default": {
@@ -228,3 +229,9 @@ ROADTRIP_USER_AGENT = "ThrillWiki Road Trip Planner (https://thrillwiki.com)"
ROADTRIP_REQUEST_TIMEOUT = 10 # seconds
ROADTRIP_MAX_RETRIES = 3
ROADTRIP_BACKOFF_FACTOR = 2
# Debug Toolbar Configuration
INTERNAL_IPS = [
"127.0.0.1",
"localhost",
]