From 463e33d219fd76b685d481da363f0651f954fcc4 Mon Sep 17 00:00:00 2001 From: Keannu Bernasol Date: Wed, 27 Nov 2024 00:49:20 +0800 Subject: [PATCH] Update scripts --- docker-compose.dev.yml | 2 ++ docmanager_backend/config/management/commands/start_watcher.py | 2 +- scripts/start.sh | 3 +-- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/docker-compose.dev.yml b/docker-compose.dev.yml index 98f8632..933247a 100644 --- a/docker-compose.dev.yml +++ b/docker-compose.dev.yml @@ -10,6 +10,8 @@ services: environment: - PYTHONBUFFERED=1 volumes: + # File Watcher is broken in Windows Docker since Docker does not notify container about any file changes you make from Windows + # If running on Windows, use a shared volume instead of bind mount - .:/app # SMTP Server diff --git a/docmanager_backend/config/management/commands/start_watcher.py b/docmanager_backend/config/management/commands/start_watcher.py index c8cd603..a6b30cf 100644 --- a/docmanager_backend/config/management/commands/start_watcher.py +++ b/docmanager_backend/config/management/commands/start_watcher.py @@ -94,7 +94,7 @@ class PDFWatcher: def run(self): event_handler = PDFHandler() - watch_directory = f"{MEDIA_ROOT}/uploads" + watch_directory = os.path.join(MEDIA_ROOT, "uploads") self.observer.schedule( event_handler, watch_directory, recursive=True) diff --git a/scripts/start.sh b/scripts/start.sh index 1db65bd..4fffa6f 100644 --- a/scripts/start.sh +++ b/scripts/start.sh @@ -8,10 +8,9 @@ if [ ! -d "static" ]; then echo "Generating static files" python manage.py collectstatic --noinput fi -if [ "$DEBUG" = 'True' ]; then tmux new-session -d -s "API File Watcher" "cd /app/docmanager_backend && python manage.py start_watcher" +if [ "$DEBUG" = 'True' ]; then python manage.py runserver "0.0.0.0:8000" else - tmux new-session -d -s "API File Watcher" "cd docmanager_backend && python manage.py start_watcher" gunicorn --workers 8 --bind 0.0.0.0:8000 config.wsgi:application fi