| import os | |
| from django.core.asgi import get_asgi_application | |
| from fastapi import FastAPI, Request | |
| from starlette.middleware.cors import CORSMiddleware | |
| print("Starting minimal ASGI app...") | |
| os.environ.setdefault("DJANGO_SETTINGS_MODULE", "mysite.settings") | |
| try: | |
| application = get_asgi_application() | |
| print("โ Django ASGI application created successfully") | |
| except Exception as e: | |
| print(f"โ Django ASGI application creation failed: {e}") | |
| application = None | |
| app = FastAPI() | |
| print("โ FastAPI application created successfully") | |
| # ใใใซใฆใงใขใฎ่จญๅฎ | |
| app.add_middleware( | |
| CORSMiddleware, | |
| allow_origins=["*"], | |
| allow_credentials=True, | |
| allow_methods=["*"], | |
| allow_headers=["*"], | |
| ) | |
| print("โ CORS middleware added successfully") | |
| def read_root(): | |
| return {"message": "FastAPI + Django app is working!"} | |
| def health_check(): | |
| return {"status": "ok"} | |
| print("โ Basic routes defined successfully") | |
| print("ASGI app setup complete!") | |