12345678910111213141516171819202122232425262728293031323334353637383940414243444546 |
- import uvicorn
- import logging
- from fastapi import Request
- from app import create_app
- from fastapi.middleware.cors import CORSMiddleware
- from fastapi.templating import Jinja2Templates
- from fastapi.responses import HTMLResponse
- app = create_app()
- templates = Jinja2Templates(directory="app/templates")
- origins = [
- "http://www.googo.org",
- "http://www.googo.org:8080",
- "http://0.0.0.0:8080",
- "http://googo.org:8080",
- "http://googo.org",
- "http://139.162.121.30",
- "http://127.0.0.1:5173",
- "http://localhost:5173"
- ]
- #uvicorn main:app --host 0.0.0.0 --port 8001
- app.add_middleware(
- CORSMiddleware,
- allow_origins=["*"],
- allow_credentials=True,
- allow_methods=["*"],
- allow_headers=["*"],
- )
- @app.get("/index.html", response_class=HTMLResponse)
- def read_index(request: Request):
- return templates.TemplateResponse("index.html", {"request": request})
- #@app.get("/ntcri_backstage/add-class.html", response_class=HTMLResponse)
- #def read_index(request: Request):
- # return templates.TemplateResponse("/ntcri_backstage/add-class.html", {"request": request})
- #@app.get("/ntcri_backstage/class-list.html", response_class=HTMLResponse)
- #def read_index(request: Request):
- # return templates.TemplateResponse("/ntcri_backstage/class-list.html", {"request": request})
- if __name__ == "__main__":
- uvicorn.run("main:app", host="cmm.ai", port=8088)
|