Browse Source

Local changes for Debugging.

bernhardbuhl 4 years ago
parent
commit
10d8a99257
2 changed files with 15 additions and 3 deletions
  1. 7 0
      README.md
  2. 8 3
      pdf_comaprison_flask_api/app.py

+ 7 - 0
README.md

@@ -31,6 +31,13 @@ flask run
 
 The app will start running on server ```127.0.0.1:5000```
 
+#### Prerequisits after download:
+* create folder output in folder /pdf_comparison_flask_api
+* create folder temp in folder /pdf_comparison_flask_api
+
+### Debugging
+``export FLASK_ENV=development`` before ``flask run``
+
 ### Using API Endpoints with Frontend
 * Run ```./api_frontend/index.html``` in your browser 
 

+ 8 - 3
pdf_comaprison_flask_api/app.py

@@ -150,10 +150,10 @@ def upload_original_file():
     uu_id = uuid.uuid1()
     if request.method == 'POST':
         if request.files:
-            resp_String = request.__str__
+            resp_String = str(request.__str__)
             try:
                 desc = request.form['description']
-                resp_String += " found descrption"
+                resp_String += " found description"
                 ref_uuid = request.form['reference_uuid']
                 resp_String += " found reference_uuid"
                 file_orig = request.files['original']
@@ -207,6 +207,7 @@ def comparison_():
             basedir = Path.cwd()
             uuid1 = request.args.get('uuid1', None)
             uuid2 = request.args.get('uuid2', None)
+            logging.error(f"UUID1: {uuid1}, uuid2: {uuid2}")
             
             orig = OriginalFile.query.filter_by(uuid = uuid1).one()
             blob = orig.original_pdf
@@ -446,6 +447,10 @@ def download_comparison_():
 def index():
     return render_template('default.html')
 
+@app.route('/ui')
+def ui():
+    return render_template('../api_frontend/index.html')
+
 @app.after_request
 def add_header(r):
     """
@@ -459,5 +464,5 @@ def add_header(r):
     return r
 
 if __name__ == "__main__":
-    logging.basicConfig(format='%(asctime)s - %(message)s', level=logging.INFO)
+    logging.basicConfig(format='%(asctime)s - %(message)s', level=logging.DEBUG)
     app.run(host='0.0.0.0')