From 81c75e1024f07c90300b6b88fcd15b9e2bdddde2 Mon Sep 17 00:00:00 2001 From: sabaimran Date: Tue, 6 Aug 2024 13:24:26 +0530 Subject: [PATCH] Fix static file folder path for the pypi build - Since the .gitignore will ignore any of the assets in the src/ folder when building the package wheel, we need to output the static assets to another folder just for the python pypi package. Use /compiled for this. --- src/interface/web/package.json | 2 +- src/khoj/app/settings.py | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/interface/web/package.json b/src/interface/web/package.json index 3dca80cc..9959d145 100644 --- a/src/interface/web/package.json +++ b/src/interface/web/package.json @@ -11,7 +11,7 @@ "cicollectstatic": "bash -c 'pushd ../../../ && python3 src/khoj/manage.py collectstatic --noinput && popd'", "export": "yarn build && cp -r out/ ../../khoj/interface/built && yarn collectstatic", "ciexport": "yarn build && cp -r out/ ../../khoj/interface/built && yarn cicollectstatic", - "pypiciexport": "yarn build && cp -r out/ /opt/hostedtoolcache/Python/3.11.9/x64/lib/python3.11/site-packages/khoj/interface/built && yarn cicollectstatic", + "pypiciexport": "yarn build && cp -r out/ /opt/hostedtoolcache/Python/3.11.9/x64/lib/python3.11/site-packages/khoj/interface/compiled && yarn cicollectstatic", "watch": "nodemon --watch . --ext js,jsx,ts,tsx,css --ignore 'out/**/*' --exec 'yarn export'", "windowswatch": "nodemon --watch . --ext js,jsx,ts,tsx,css --ignore 'out/**/*' --exec 'yarn windowsexport'", "windowscollectstatic": "cd ..\\..\\.. && .\\.venv\\Scripts\\Activate.bat && py .\\src\\khoj\\manage.py collectstatic --noinput && .\\.venv\\Scripts\\deactivate.bat && cd ..", diff --git a/src/khoj/app/settings.py b/src/khoj/app/settings.py index 7bbb8dc4..020b2b2e 100644 --- a/src/khoj/app/settings.py +++ b/src/khoj/app/settings.py @@ -166,7 +166,12 @@ USE_TZ = True # https://docs.djangoproject.com/en/4.2/howto/static-files/ STATIC_ROOT = BASE_DIR / "static" -STATICFILES_DIRS = [BASE_DIR / "interface/web", BASE_DIR / "interface/email", BASE_DIR / "interface/built"] +STATICFILES_DIRS = [ + BASE_DIR / "interface/web", + BASE_DIR / "interface/email", + BASE_DIR / "interface/built", + BASE_DIR / "interface/compiled", +] STATIC_URL = "/static/" # Default primary key field type