mirror of
https://github.com/mealie-recipes/mealie.git
synced 2025-12-03 09:04:06 -05:00
* migration redesign init * new color picker * changelog * added UI language selection * fix layout issue on recipe editor * remove git as dependency * added UI editor for original URL * CI/CD Tests * test: fixed migration routes * test todos * bug/added docker volume * chowdow test data * partial image recipe image testing * added card section card * settings form * homepage cetegory ui * frontend category placeholder * fixed broken scheduler * remove old files * removed temp test Co-authored-by: Hayden <hay-kot@pm.me>
81 lines
1.6 KiB
Python
81 lines
1.6 KiB
Python
import uvicorn
|
|
from fastapi import FastAPI
|
|
from fastapi.staticfiles import StaticFiles
|
|
|
|
# import utils.startup as startup
|
|
from app_config import PORT, PRODUCTION, WEB_PATH, docs_url, redoc_url
|
|
from routes import (
|
|
backup_routes,
|
|
meal_routes,
|
|
migration_routes,
|
|
recipe_routes,
|
|
setting_routes,
|
|
static_routes,
|
|
user_routes,
|
|
)
|
|
|
|
from utils.api_docs import generate_api_docs
|
|
from utils.logger import logger
|
|
|
|
app = FastAPI(
|
|
title="Mealie",
|
|
description="A place for all your recipes",
|
|
version="0.0.1",
|
|
docs_url=docs_url,
|
|
redoc_url=redoc_url,
|
|
)
|
|
|
|
|
|
def mount_static_files():
|
|
app.mount("/static", StaticFiles(directory=WEB_PATH, html=True))
|
|
|
|
|
|
def api_routers():
|
|
# First
|
|
print()
|
|
app.include_router(recipe_routes.router)
|
|
app.include_router(meal_routes.router)
|
|
app.include_router(setting_routes.router)
|
|
app.include_router(backup_routes.router)
|
|
app.include_router(user_routes.router)
|
|
app.include_router(migration_routes.router)
|
|
|
|
|
|
if PRODUCTION:
|
|
mount_static_files()
|
|
|
|
api_routers()
|
|
|
|
|
|
def start_scheduler():
|
|
import services.scheduler.scheduled_jobs
|
|
|
|
|
|
# API 404 Catch all CALL AFTER ROUTERS
|
|
@app.get("/api/{full_path:path}", status_code=404, include_in_schema=False)
|
|
def invalid_api():
|
|
return None
|
|
|
|
|
|
app.include_router(static_routes.router)
|
|
|
|
|
|
# Generate API Documentation
|
|
if not PRODUCTION:
|
|
generate_api_docs(app)
|
|
|
|
start_scheduler()
|
|
|
|
if __name__ == "__main__":
|
|
logger.info("-----SYSTEM STARTUP-----")
|
|
|
|
uvicorn.run(
|
|
"app:app",
|
|
host="0.0.0.0",
|
|
port=PORT,
|
|
reload=True,
|
|
debug=True,
|
|
workers=1,
|
|
forwarded_allow_ips="*",
|
|
)
|