mirror of
https://github.com/khoaliber/khoj.git
synced 2026-03-06 13:22:12 +00:00
Use an ASGI application, rather than WSGI
- ASGI should be the preferred application, as our codebase runs a lot of async code
This commit is contained in:
16
src/khoj/app/asgi.py
Normal file
16
src/khoj/app/asgi.py
Normal file
@@ -0,0 +1,16 @@
|
||||
"""
|
||||
ASGI config for app project.
|
||||
|
||||
It exposes the ASGI callable as a module-level variable named ``application``.
|
||||
|
||||
For more information on this file, see
|
||||
https://docs.djangoproject.com/en/4.2/howto/deployment/asgi/
|
||||
"""
|
||||
|
||||
import os
|
||||
|
||||
from django.core.asgi import get_asgi_application
|
||||
|
||||
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "khoj.app.settings")
|
||||
|
||||
application = get_asgi_application()
|
||||
@@ -108,7 +108,7 @@ TEMPLATES = [
|
||||
},
|
||||
]
|
||||
|
||||
WSGI_APPLICATION = "app.wsgi.application"
|
||||
ASGI_APPLICATION = "app.asgi.application"
|
||||
|
||||
# Database
|
||||
# https://docs.djangoproject.com/en/4.2/ref/settings/#databases
|
||||
|
||||
@@ -1,16 +0,0 @@
|
||||
"""
|
||||
WSGI config for app project.
|
||||
|
||||
It exposes the WSGI callable as a module-level variable named ``application``.
|
||||
|
||||
For more information on this file, see
|
||||
https://docs.djangoproject.com/en/4.2/howto/deployment/wsgi/
|
||||
"""
|
||||
|
||||
import os
|
||||
|
||||
from django.core.wsgi import get_wsgi_application
|
||||
|
||||
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "khoj.app.settings")
|
||||
|
||||
application = get_wsgi_application()
|
||||
@@ -328,7 +328,7 @@ def update_content_index_regularly():
|
||||
)
|
||||
|
||||
|
||||
@schedule.repeat(schedule.every(1).to(2).hours)
|
||||
@schedule.repeat(schedule.every(30).to(59).minutes)
|
||||
def close_all_db_connections():
|
||||
from django import db
|
||||
|
||||
|
||||
Reference in New Issue
Block a user