GitHub Action
๐Ÿš€ Auto-deploy from GitHub Actions
7b7bdab
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")
@app.get("/")
def read_root():
return {"message": "FastAPI + Django app is working!"}
@app.get("/health")
def health_check():
return {"status": "ok"}
print("โœ“ Basic routes defined successfully")
print("ASGI app setup complete!")