Initial commit
This commit is contained in:
0
gestion_pedidos/management/commands/__init__.py
Normal file
0
gestion_pedidos/management/commands/__init__.py
Normal file
28
gestion_pedidos/management/commands/start_file_watcher.py
Normal file
28
gestion_pedidos/management/commands/start_file_watcher.py
Normal file
@@ -0,0 +1,28 @@
|
||||
"""
|
||||
Comando para iniciar el file watcher que monitorea carpetas
|
||||
"""
|
||||
from django.core.management.base import BaseCommand
|
||||
from gestion_pedidos.services.file_watcher import FileWatcherService
|
||||
import time
|
||||
import logging
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class Command(BaseCommand):
|
||||
help = 'Inicia el servicio de monitoreo de carpetas para procesar PDFs y albaranes automáticamente'
|
||||
|
||||
def handle(self, *args, **options):
|
||||
self.stdout.write(self.style.SUCCESS('Iniciando file watcher...'))
|
||||
|
||||
watcher = FileWatcherService()
|
||||
watcher.start()
|
||||
|
||||
try:
|
||||
while True:
|
||||
time.sleep(1)
|
||||
except KeyboardInterrupt:
|
||||
self.stdout.write(self.style.WARNING('\nDeteniendo file watcher...'))
|
||||
watcher.stop()
|
||||
self.stdout.write(self.style.SUCCESS('File watcher detenido.'))
|
||||
|
||||
Reference in New Issue
Block a user