From 337e638ff007ce3ffd495b75d868a1d755be942a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Niklas=20M=C3=BCller?= Date: Tue, 23 Jan 2024 16:27:40 +0100 Subject: [PATCH] converted to vue.js --- Dockerfile | 2 +- app.py | 8 ++-- init.sh | 2 +- templates/index.html | 90 +++++++++++++++++++++++++++++++++++++------- 4 files changed, 83 insertions(+), 19 deletions(-) diff --git a/Dockerfile b/Dockerfile index 8877906..9a228d4 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,5 @@ - FROM python:3.11-slim +# FROM python:3.11.3 # set the working directory WORKDIR /app diff --git a/app.py b/app.py index 6770ec2..1689f03 100644 --- a/app.py +++ b/app.py @@ -1,9 +1,9 @@ import shutil import os from flask import Flask, render_template, request, redirect, jsonify, send_from_directory -from pypdf import PdfReader, PdfWriter from pathlib import Path from pdf_util.pdf_util import pdf_util +# from pdf_util.pdf_project_manager import pdf_project_manager import datetime as dt import logging @@ -44,10 +44,10 @@ def send_merge(path): @app.route('/split_to_zip', methods=['POST']) def split_to_zip(): - if 'pdf' not in request.files: + if 'pdf_1' not in request.files: return redirect(request.url) - pdf_file = request.files['pdf'] + pdf_file = request.files['pdf_1'] if pdf_file.filename == '': return redirect(request.url) @@ -63,7 +63,7 @@ def split_to_zip(): logging.debug(in_filename) logging.debug(os.path.splitext(pdf_file.filename)[0]) - + shutil.make_archive(in_filename + '_splitted', 'zip', os.path.dirname(filename) + "/split_pdf") zip_filename = in_filename + "_splitted.zip" os.rename("/app/" + zip_filename, "/app/split/" + zip_filename) diff --git a/init.sh b/init.sh index 0f7b310..f1fe207 100755 --- a/init.sh +++ b/init.sh @@ -4,6 +4,6 @@ (cd /app/ && pytest -o log_cli=true) # (cd /app/ && gunicorn -w 4 -b 0.0.0.0:8000 wsgi:app) -(cd /app/ && gunicorn --access-logfile '-' --error-logfile '-' -w 4 -b 0.0.0.0:8000 wsgi:app) # Dev (Logging to console) +(cd /app/ && gunicorn --access-logfile '-' --error-logfile '-' -w 4 -b 0.0.0.0:8000 wsgi:app --log-level debug) # Dev (Logging to console) /bin/bash \ No newline at end of file diff --git a/templates/index.html b/templates/index.html index b603233..ff4fc8a 100644 --- a/templates/index.html +++ b/templates/index.html @@ -1,19 +1,83 @@ - + - PDF Web Toolkit - - + + + PDF Tools -

PDF Splitter

-
- -

PDF Merger

-
-
- -
+
+

PDF Splitter

+
+ + +

PDF Merger

+
+
+ + +
{{ outputMessage }}
+
+ + + + - + \ No newline at end of file