mirror of
https://github.com/khoaliber/khoj.git
synced 2026-03-09 21:29:11 +00:00
Use full path for the static directory in FastAPI and reflect deeper nesting of the django app
This commit is contained in:
@@ -14,7 +14,7 @@ from pathlib import Path
|
|||||||
import os
|
import os
|
||||||
|
|
||||||
# Build paths inside the project like this: BASE_DIR / 'subdir'.
|
# Build paths inside the project like this: BASE_DIR / 'subdir'.
|
||||||
BASE_DIR = Path(__file__).resolve().parent.parent.parent.parent
|
BASE_DIR = Path(__file__).resolve().parent.parent
|
||||||
|
|
||||||
|
|
||||||
# Quick-start development settings - unsuitable for production
|
# Quick-start development settings - unsuitable for production
|
||||||
@@ -143,7 +143,7 @@ USE_TZ = True
|
|||||||
# https://docs.djangoproject.com/en/4.2/howto/static-files/
|
# https://docs.djangoproject.com/en/4.2/howto/static-files/
|
||||||
|
|
||||||
STATIC_ROOT = BASE_DIR / "static"
|
STATIC_ROOT = BASE_DIR / "static"
|
||||||
STATICFILES_DIRS = [BASE_DIR / "src/khoj/interface/web"]
|
STATICFILES_DIRS = [BASE_DIR / "interface/web"]
|
||||||
STATIC_URL = "/static/"
|
STATIC_URL = "/static/"
|
||||||
|
|
||||||
# Default primary key field type
|
# Default primary key field type
|
||||||
|
|||||||
@@ -107,10 +107,10 @@ def run(should_start_server=True):
|
|||||||
|
|
||||||
# Mount Django and Static Files
|
# Mount Django and Static Files
|
||||||
app.mount("/server", django_app, name="server")
|
app.mount("/server", django_app, name="server")
|
||||||
static_dir = "static"
|
static_dir = os.path.join(os.path.dirname(os.path.abspath(__file__)), "static")
|
||||||
if not os.path.exists(static_dir):
|
if not os.path.exists(static_dir):
|
||||||
os.mkdir(static_dir)
|
os.mkdir(static_dir)
|
||||||
app.mount(f"/{static_dir}", StaticFiles(directory=static_dir), name=static_dir)
|
app.mount(f"/static", StaticFiles(directory=static_dir), name=static_dir)
|
||||||
|
|
||||||
# Configure Middleware
|
# Configure Middleware
|
||||||
configure_middleware(app)
|
configure_middleware(app)
|
||||||
|
|||||||
Reference in New Issue
Block a user