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:
sabaimran 2024-06-05 09:25:08 +05:30
parent 0816cec4bc
commit a9c383e62c
4 changed files with 18 additions and 18 deletions

16
src/khoj/app/asgi.py Normal file
View 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()

View file

@ -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

View file

@ -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()

View file

@ -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