Files
smoothschedule/smoothschedule/config/asgi.py
poduck 156cc2676d refactor: Reorganize Django apps into domain-based structure
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>
2025-12-07 18:24:50 -05:00

30 lines
1011 B
Python

import os
from django.core.asgi import get_asgi_application
# Fetch Django's ASGI application early to ensure the AppRegistry is populated
# before importing code that may import ORM models.
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "config.settings.local") # Use local settings for ASGI
django_asgi_app = get_asgi_application()
from channels.auth import AuthMiddlewareStack
from channels.routing import ProtocolTypeRouter, URLRouter
from smoothschedule.commerce.tickets import routing as tickets_routing
from smoothschedule.scheduling.schedule import routing as schedule_routing
from smoothschedule.commerce.tickets.middleware import TokenAuthMiddleware
application = ProtocolTypeRouter(
{
"http": django_asgi_app,
"websocket": AuthMiddlewareStack(
TokenAuthMiddleware(
URLRouter(
tickets_routing.websocket_urlpatterns +
schedule_routing.websocket_urlpatterns
)
)
),
}
)