| import os | |
| FRONTEND_PATH = os.getenv("FRONTEND_PATH") | |
| SERVE_FRONTEND = os.getenv("FRONTEND_PATH") is not None | |
| FRONTEND_ASSETS_PATH = os.path.join(FRONTEND_PATH, "assets") if SERVE_FRONTEND else None | |
| FRONTEND_INDEX_PATH = ( | |
| os.path.join(FRONTEND_PATH, "index.html") if SERVE_FRONTEND else None | |
| ) | |
| if SERVE_FRONTEND and ( | |
| not os.path.exists(FRONTEND_PATH) | |
| or not os.path.exists(FRONTEND_ASSETS_PATH) | |
| or not os.path.exists(FRONTEND_INDEX_PATH) | |
| ): | |
| raise FileNotFoundError( | |
| f"FRONTEND_PATH {FRONTEND_PATH} has not been built correctly. Please build the frontend first by running `pnpm build` from the 'frontend/' directory." | |
| " If you want to run the server in development mode, run `make dev` from the 'backend/' directory and `pnpm dev` from the 'frontend/' directory." | |
| ) | |