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

@@ -30,27 +30,36 @@ urlpatterns = [
path("", HomeView.as_view(), name="home"),
# Autocomplete URLs (must be before other URLs)
path("ac/", autocomplete_urls),
# API Documentation URLs
path("api/schema/", SpectacularAPIView.as_view(), name="schema") if HAS_SPECTACULAR else path("", lambda r: None),
path("api/docs/", SpectacularSwaggerView.as_view(url_name="schema"), name="swagger-ui") if HAS_SPECTACULAR else path("", lambda r: None),
path("api/redoc/", SpectacularRedocView.as_view(url_name="schema"), name="redoc") if HAS_SPECTACULAR else path("", lambda r: None),
path("api/schema/", SpectacularAPIView.as_view(),
name="schema") if HAS_SPECTACULAR else path("", lambda r: None),
path("api/docs/", SpectacularSwaggerView.as_view(url_name="schema"),
name="swagger-ui") if HAS_SPECTACULAR else path("", lambda r: None),
path("api/redoc/", SpectacularRedocView.as_view(url_name="schema"),
name="redoc") if HAS_SPECTACULAR else path("", lambda r: None),
# Health Check URLs
path("health/", include("health_check.urls")),
path("health/api/", HealthCheckAPIView.as_view(), name="health-api") if HAS_HEALTH_VIEWS else path("", lambda r: None),
path("health/simple/", SimpleHealthView.as_view(), name="health-simple") if HAS_HEALTH_VIEWS else path("", lambda r: None),
path("health/metrics/", PerformanceMetricsView.as_view(), name="health-metrics") if HAS_HEALTH_VIEWS else path("", lambda r: None),
path("health/api/", HealthCheckAPIView.as_view(),
name="health-api") if HAS_HEALTH_VIEWS else path("", lambda r: None),
path("health/simple/", SimpleHealthView.as_view(),
name="health-simple") if HAS_HEALTH_VIEWS else path("", lambda r: None),
path("health/metrics/", PerformanceMetricsView.as_view(),
name="health-metrics") if HAS_HEALTH_VIEWS else path("", lambda r: None),
# API URLs (before app URLs to avoid conflicts)
path("api/v1/", include("parks.api.urls", namespace="parks_api")),
path("api/v1/", include("rides.api.urls", namespace="rides_api")),
path("api/v1/map/", include("core.urls.map_urls", namespace="map_api")), # Map API URLs
path("api/v1/map/", include("core.urls.map_urls",
namespace="map_api")), # Map API URLs
# Parks and Rides URLs
path("parks/", include("parks.urls", namespace="parks")),
# Global rides URLs
path("rides/", include("rides.urls", namespace="rides")),
# Operators URLs
path("operators/", include("parks.urls", namespace="operators")),
# Other URLs
path("photos/", include("media.urls", namespace="photos")), # Add photos URLs
path("search/", include("core.urls.search", namespace="search")),
@@ -93,9 +102,11 @@ urlpatterns = [
# Serve static files in development
if settings.DEBUG:
urlpatterns += static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
urlpatterns += static(settings.STATIC_URL,
document_root=settings.STATIC_ROOT)
urlpatterns += static(settings.MEDIA_URL,
document_root=settings.MEDIA_ROOT)
# Development monitoring URLs
try:
import debug_toolbar
@@ -104,13 +115,13 @@ if settings.DEBUG:
] + urlpatterns
except ImportError:
pass
try:
import silk
urlpatterns += [path('silk/', include('silk.urls', namespace='silk'))]
except ImportError:
pass
# Serve test coverage reports in development
coverage_dir = os.path.join(settings.BASE_DIR, 'tests', 'coverage_html')
if os.path.exists(coverage_dir):