From 18254850abf245f3dfb7af8e8c546402627165b3 Mon Sep 17 00:00:00 2001 From: sabaimran Date: Tue, 28 Nov 2023 09:39:44 -0800 Subject: [PATCH] Set a default value for the khoj django secret key and add additional guidance for setting environment variables on first run --- docs/setup.md | 34 ++++++++++++++++++++++++++++++++++ src/khoj/app/settings.py | 2 +- 2 files changed, 35 insertions(+), 1 deletion(-) diff --git a/docs/setup.md b/docs/setup.md index ec60a3d3..ce948a0e 100644 --- a/docs/setup.md +++ b/docs/setup.md @@ -123,6 +123,40 @@ python -m pip install khoj-assistant ##### Local Server Start +Before getting started, configure the following environment variables in your terminal for the first run + + + +#### **MacOS** + +```shell +export KHOJ_ADMIN_EMAIL= +export KHOJ_ADMIN_PASSWORD= +``` + +#### **Windows** + +If you're using PowerShell: +```shell +$env:KHOJ_ADMIN_EMAIL="" +$env:KHOJ_ADMIN_PASSWORD="" +``` + +If you're using a Unix shell: +```shell +export KHOJ_ADMIN_EMAIL="" +export KHOJ_ADMIN_PASSWORD="" +``` + +#### **Linux** + +```shell +export KHOJ_ADMIN_EMAIL= +export KHOJ_ADMIN_PASSWORD= +``` + + + Run the following command from your terminal to start the Khoj backend and open Khoj in your browser. ```shell diff --git a/src/khoj/app/settings.py b/src/khoj/app/settings.py index 39af3d7a..2b86e5cc 100644 --- a/src/khoj/app/settings.py +++ b/src/khoj/app/settings.py @@ -21,7 +21,7 @@ BASE_DIR = Path(__file__).resolve().parent.parent # See https://docs.djangoproject.com/en/4.2/howto/deployment/checklist/ # SECURITY WARNING: keep the secret key used in production secret! -SECRET_KEY = os.getenv("KHOJ_DJANGO_SECRET_KEY") +SECRET_KEY = os.getenv("KHOJ_DJANGO_SECRET_KEY", "!secret") # SECURITY WARNING: don't run with debug turned on in production! DEBUG = os.getenv("KHOJ_DEBUG") == "True"