Added Login + Working on pdf creation
This commit is contained in:
@@ -7,6 +7,9 @@ WORKDIR /app
|
||||
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||
libmagic1 \
|
||||
file \
|
||||
pandoc \
|
||||
ghostscript \
|
||||
texlive-xetex \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Copy requirements and install dependencies
|
||||
|
||||
@@ -34,22 +34,6 @@ def get_redis_url() -> str:
|
||||
return os.getenv("REDIS_URL", "redis://localhost:6379/0")
|
||||
|
||||
|
||||
# def get_redis_host() -> str:
|
||||
# redis_url = get_redis_url()
|
||||
# if redis_url.startswith("redis://"):
|
||||
# return redis_url.split("redis://")[1].split("/")[0]
|
||||
# else:
|
||||
# return redis_url
|
||||
#
|
||||
#
|
||||
# def get_redis_port() -> int:
|
||||
# redis_url = get_redis_url()
|
||||
# if redis_url.startswith("redis://"):
|
||||
# return int(redis_url.split("redis://")[1].split("/")[0].split(":")[1])
|
||||
# else:
|
||||
# return int(redis_url.split(":")[1])
|
||||
|
||||
|
||||
def get_jwt_secret_key() -> str:
|
||||
"""
|
||||
Get JWT secret key from environment variables.
|
||||
@@ -114,6 +98,11 @@ def get_objects_folder() -> str:
|
||||
return os.getenv("OBJECTS_FOLDER", "/objects")
|
||||
|
||||
|
||||
def watch_directory() -> str:
|
||||
def get_watch_folder() -> str:
|
||||
"""Directory to monitor for new files"""
|
||||
return os.getenv("WATCH_DIRECTORY", "/watched_files")
|
||||
|
||||
|
||||
def get_temp_folder() -> str:
|
||||
"""Directory to store temporary files"""
|
||||
return os.getenv("TEMP_DIRECTORY", "/temp")
|
||||
|
||||
@@ -63,17 +63,15 @@ class DocumentFileEventHandler(FileSystemEventHandler):
|
||||
|
||||
logger.info(f"Processing new file: {filepath}")
|
||||
|
||||
# try:
|
||||
from tasks.document_processing import process_document
|
||||
task_result = process_document.delay(filepath)
|
||||
print(task_result)
|
||||
print("hello world")
|
||||
# task_id = task_result.task_id
|
||||
# logger.info(f"Dispatched Celery task with ID: {task_id}")
|
||||
try:
|
||||
from tasks.document_processing import process_document
|
||||
task_result = process_document.delay(filepath)
|
||||
task_id = task_result.task_id
|
||||
logger.info(f"Dispatched Celery task with ID: {task_id}")
|
||||
|
||||
# except Exception as e:
|
||||
# logger.error(f"Failed to process file {filepath}: {str(e)}")
|
||||
# # Note: We don't re-raise the exception to keep the watcher running
|
||||
except Exception as e:
|
||||
logger.error(f"Failed to process file {filepath}: {str(e)}")
|
||||
# Note: We don't re-raise the exception to keep the watcher running
|
||||
|
||||
|
||||
class FileWatcher:
|
||||
|
||||
@@ -65,12 +65,12 @@ async def lifespan(app: FastAPI) -> AsyncGenerator[None, None]:
|
||||
|
||||
# Create and start file watcher
|
||||
file_watcher = create_file_watcher(
|
||||
watch_directory=settings.watch_directory(),
|
||||
watch_directory=settings.get_watch_folder(),
|
||||
document_service=document_service,
|
||||
job_service=job_service
|
||||
)
|
||||
file_watcher.start()
|
||||
logger.info(f"FileWatcher started for directory: {settings.watch_directory()}")
|
||||
logger.info(f"FileWatcher started for directory: {settings.get_watch_folder()}")
|
||||
|
||||
logger.info("Application startup completed successfully")
|
||||
|
||||
@@ -102,7 +102,7 @@ app = FastAPI(
|
||||
# Configure CORS
|
||||
app.add_middleware(
|
||||
CORSMiddleware,
|
||||
allow_origins=["http://localhost:5173"], # React frontend
|
||||
allow_origins=["http://localhost:5173", "http://localhost:5174"], # React frontend
|
||||
allow_credentials=True,
|
||||
allow_methods=["*"],
|
||||
allow_headers=["*"],
|
||||
|
||||
@@ -5,11 +5,14 @@ email-validator==2.3.0
|
||||
fastapi==0.116.1
|
||||
httptools==0.6.4
|
||||
motor==3.7.1
|
||||
pillow==11.3.0
|
||||
pydantic==2.11.9
|
||||
PyJWT==2.10.1
|
||||
pymongo==4.15.0
|
||||
pypandoc==1.15
|
||||
python-multipart==0.0.20
|
||||
redis==6.4.0
|
||||
reportlab==4.4.4
|
||||
uvicorn==0.35.0
|
||||
python-magic==0.4.27
|
||||
watchdog==6.0.0
|
||||
Reference in New Issue
Block a user