Restructured 13 Django apps from flat/mixed organization into 5 logical
domain packages following cookiecutter-django conventions:
- identity/: core (tenant/domain models, middleware, mixins), users
- scheduling/: schedule, contracts, analytics
- communication/: notifications, credits, mobile, messaging
- commerce/: payments, tickets
- platform/: admin, api
Key changes:
- Moved all apps to smoothschedule/smoothschedule/{domain}/{app}/
- Updated all import paths across the codebase
- Updated settings (base.py, multitenancy.py, test.py)
- Updated URL configuration in config/urls.py
- Updated middleware and permission paths
- Preserved app_label in AppConfig for migration compatibility
- Updated CLAUDE.md documentation with new structure
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
40 lines
910 B
Python
40 lines
910 B
Python
"""
|
|
Create a default tenant for local development
|
|
"""
|
|
from smoothschedule.identity.core.models import Tenant, Domain
|
|
from django.contrib.auth import get_user_model
|
|
|
|
User = get_user_model()
|
|
|
|
# Create default tenant for local development
|
|
tenant, created = Tenant.objects.get_or_create(
|
|
schema_name='public',
|
|
defaults={
|
|
'name': 'Default Tenant',
|
|
'subscription_tier': 'PROFESSIONAL',
|
|
'max_users': 100,
|
|
'max_resources': 100,
|
|
}
|
|
)
|
|
|
|
if created:
|
|
print(f"Created tenant: {tenant.name}")
|
|
else:
|
|
print(f"Tenant already exists: {tenant.name}")
|
|
|
|
# Create domain for localhost
|
|
domain, created = Domain.objects.get_or_create(
|
|
domain='localhost',
|
|
defaults={
|
|
'tenant': tenant,
|
|
'is_primary': True,
|
|
}
|
|
)
|
|
|
|
if created:
|
|
print(f"Created domain: {domain.domain}")
|
|
else:
|
|
print(f"Domain already exists: {domain.domain}")
|
|
|
|
print("Setup complete!")
|