mirror of
https://github.com/khoj-ai/khoj.git
synced 2024-11-23 23:48:56 +01:00
Explicitly set Khoj to use the default locale of the user (#425)
- Explicitly set locale using `locale.setLocale(locale.LC_ALL, '')` for localization. Relevant for datetime libraries. See [Python 3 documentation](https://docs.python.org/3/library/locale.html#locale.setlocale).
This commit is contained in:
parent
cc951450fb
commit
738cf650b3
1 changed files with 4 additions and 0 deletions
|
@ -2,6 +2,7 @@
|
|||
import os
|
||||
import signal
|
||||
import sys
|
||||
import locale
|
||||
|
||||
if sys.stdout is None:
|
||||
sys.stdout = open(os.devnull, "w")
|
||||
|
@ -32,6 +33,9 @@ from khoj.utils.cli import cli
|
|||
# Initialize the Application Server
|
||||
app = FastAPI()
|
||||
|
||||
# Set Locale
|
||||
locale.setlocale(locale.LC_ALL, "")
|
||||
|
||||
# Setup Logger
|
||||
rich_handler = RichHandler(rich_tracebacks=True)
|
||||
rich_handler.setFormatter(fmt=logging.Formatter(fmt="%(message)s", datefmt="[%X]"))
|
||||
|
|
Loading…
Reference in a new issue