This commit includes: - Django backend with multi-tenancy (django-tenants) - React + TypeScript frontend with Vite - Platform administration API with role-based access control - Authentication system with token-based auth - Quick login dev tools for testing different user roles - CORS and CSRF configuration for local development - Docker development environment setup 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
40 lines
886 B
Python
40 lines
886 B
Python
"""
|
|
Create a default tenant for local development
|
|
"""
|
|
from 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!")
|