File size: 810 Bytes
51e559a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
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."
    )