Skip to content

Commit

Permalink
Change MREPORT_LOCATION to relative backend/reports location
Browse files Browse the repository at this point in the history
  • Loading branch information
spelhate committed Jun 5, 2020
1 parent f7e4e3c commit 6700cfe
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
9 changes: 5 additions & 4 deletions backend/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ def __call__(self, environ, start_response):
schema = schema+'.'

db = SQLAlchemy(app)

#MODELS


Expand Down Expand Up @@ -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)
Expand All @@ -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':
Expand Down Expand Up @@ -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
2 changes: 1 addition & 1 deletion config.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"



0 comments on commit 6700cfe

Please sign in to comment.