35 lines
860 B
Python
35 lines
860 B
Python
import locale
|
|
|
|
from fastapi import FastAPI
|
|
from fastapi.middleware.cors import CORSMiddleware
|
|
from fastapi.staticfiles import StaticFiles
|
|
|
|
from fabcal.routers import api_v1, frontend
|
|
|
|
|
|
app = FastAPI()
|
|
|
|
app.mount("/static", StaticFiles(directory="static"), name="static")
|
|
|
|
for framework in ["normalize.css", "milligram", "@fortawesome/fontawesome-free"]:
|
|
app.mount(f"/assets/{framework}", StaticFiles(directory=f"node_modules/{framework}"), name=framework)
|
|
|
|
app.include_router(api_v1.router, prefix="/api/v1")
|
|
app.include_router(frontend.router, prefix="")
|
|
|
|
app.add_middleware(
|
|
CORSMiddleware,
|
|
allow_origins=[
|
|
"https://fablab-altmuehlfranken.de",
|
|
"https://www.fablab-altmuehlfranken.de",
|
|
],
|
|
)
|
|
|
|
|
|
locale.setlocale(locale.LC_TIME, locale.getlocale())
|
|
|
|
|
|
if __name__ == "__main__":
|
|
import uvicorn
|
|
uvicorn.run(app, debug=True)
|