summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDirk Engling <erdgeist@erdgeist.org>2020-04-24 01:21:55 +0200
committerDirk Engling <erdgeist@erdgeist.org>2020-04-24 01:21:55 +0200
commit3817be7007a14458fa9def004e26a62f15a2ff82 (patch)
treef13cf6600682c4433b3de7155adb35d600e9b354
parentba8d67c3ed97ae6ee94f710d8b661712e68cfdb5 (diff)
Create working dirs on startup, if missing
-rwxr-xr-xFiler.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/Filer.py b/Filer.py
index bcd6165..e737047 100755
--- a/Filer.py
+++ b/Filer.py
@@ -7,6 +7,7 @@ from os import unlink, path, getenv, listdir, mkdir, urandom
7from shutil import rmtree 7from shutil import rmtree
8from threading import Thread 8from threading import Thread
9from random import randint 9from random import randint
10from sys import stderr, exit
10 11
11from flask import Flask, render_template, jsonify, request, redirect, send_from_directory 12from flask import Flask, render_template, jsonify, request, redirect, send_from_directory
12from flask_dropzone import Dropzone 13from flask_dropzone import Dropzone
@@ -171,6 +172,17 @@ thread = Thread(target=cleaner_thread, args=())
171thread.daemon = True 172thread.daemon = True
172thread.start() 173thread.start()
173 174
175try:
176 if not path.exists(path.join(basedir, 'Dokumente')):
177 mkdir(path.join(basedir, 'Dokumente'))
178 if not path.exists(path.join(basedir, 'Mandanten')):
179 mkdir(path.join(basedir, 'Mandanten'))
180 if not path.exists(path.join(basedir, 'Public')):
181 mkdir(path.join(basedir, 'Public'))
182except:
183 stderr.write("Error: Basedir not accessible\n")
184 exit(1)
185
174if __name__ == "__main__": 186if __name__ == "__main__":
175 parser = ArgumentParser(description="Filer") 187 parser = ArgumentParser(description="Filer")
176 parser.add_argument("-H", "--host", help="Hostname of the Flask app " + "[default %s]" % "127.0.0.1", default="127.0.0.1") 188 parser.add_argument("-H", "--host", help="Hostname of the Flask app " + "[default %s]" % "127.0.0.1", default="127.0.0.1")