From 6700cfeca39c9ee1297894989ab5662e730e4f93 Mon Sep 17 00:00:00 2001 From: spelhate Date: Fri, 5 Jun 2020 08:37:44 +0200 Subject: [PATCH] Change MREPORT_LOCATION to relative backend/reports location --- backend/__init__.py | 9 +++++---- config.py | 2 +- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/backend/__init__.py b/backend/__init__.py index b17c99e..42559fa 100644 --- a/backend/__init__.py +++ b/backend/__init__.py @@ -39,6 +39,7 @@ def __call__(self, environ, start_response): schema = schema+'.' db = SQLAlchemy(app) + #MODELS @@ -275,8 +276,8 @@ def put(self,report_id): rep = Report(**data) except TypeError as err: return {"response": str(err)}, 400 - source = "/".join([app.config['MREPORT_LOCATION'], "reports", "models", "default"]) - destination = "/".join([app.config['MREPORT_LOCATION'], "reports", report_id]) + source = "/".join([app.config['MREPORT_LOCATION'], "models", "default"]) + destination = "/".join([app.config['MREPORT_LOCATION'], report_id]) fss = createFileSystemStructure(source, destination) if fss == 'success': db.session.add(rep) @@ -303,7 +304,7 @@ def post(self, report_id): return {"response": "report doesn't exists."}, 404 def delete(self, report_id): rep = Report.query.get(report_id) - folder = "/".join([app.config['MREPORT_LOCATION'], "reports", report_id]) + folder = "/".join([app.config['MREPORT_LOCATION'], report_id]) if rep: delete_folder = deleteFileSystemStructure(folder) if delete_folder == 'success': @@ -398,7 +399,7 @@ def post(self,report_id): data = {"response": "ERROR no data supplied"} return data, 405 else: - up = updateReportHTML("/".join([app.config['MREPORT_LOCATION'], "reports", report_id, "report.html"]), html) + up = updateReportHTML("/".join([app.config['MREPORT_LOCATION'], report_id, "report.html"]), html) return {"response": up} # return app diff --git a/config.py b/config.py index c0433f0..dc886de 100644 --- a/config.py +++ b/config.py @@ -4,7 +4,7 @@ SQLALCHEMY_DATABASE_URI = 'sqlite:///data.db' SQLALCHEMY_TRACK_MODIFICATIONS = False SCHEMA = "data" ## Comment this line if you don't need schema or if you use SQLite -MREPORT_LOCATION = "/var/www/html/mreport" +MREPORT_LOCATION = "backend/reports"