11 lines
471 B
Python
11 lines
471 B
Python
from django.utils.deprecation import MiddlewareMixin
|
||
|
||
class SSHConnectionMiddleware(MiddlewareMixin):
|
||
_connection_checked = False # Sınıf değişkeni olarak tanımla
|
||
|
||
def process_request(self, request):
|
||
# Sadece bir kez çalıştır
|
||
if not SSHConnectionMiddleware._connection_checked:
|
||
from .apps import check_server_connection
|
||
check_server_connection()
|
||
SSHConnectionMiddleware._connection_checked = True |