diff options
author | Dirk Engling <erdgeist@erdgeist.org> | 2020-04-24 01:21:55 +0200 |
---|---|---|
committer | Dirk Engling <erdgeist@erdgeist.org> | 2020-04-24 01:21:55 +0200 |
commit | 3817be7007a14458fa9def004e26a62f15a2ff82 (patch) | |
tree | f13cf6600682c4433b3de7155adb35d600e9b354 | |
parent | ba8d67c3ed97ae6ee94f710d8b661712e68cfdb5 (diff) |
Create working dirs on startup, if missing
-rwxr-xr-x | Filer.py | 12 |
1 files changed, 12 insertions, 0 deletions
@@ -7,6 +7,7 @@ from os import unlink, path, getenv, listdir, mkdir, urandom | |||
7 | from shutil import rmtree | 7 | from shutil import rmtree |
8 | from threading import Thread | 8 | from threading import Thread |
9 | from random import randint | 9 | from random import randint |
10 | from sys import stderr, exit | ||
10 | 11 | ||
11 | from flask import Flask, render_template, jsonify, request, redirect, send_from_directory | 12 | from flask import Flask, render_template, jsonify, request, redirect, send_from_directory |
12 | from flask_dropzone import Dropzone | 13 | from flask_dropzone import Dropzone |
@@ -171,6 +172,17 @@ thread = Thread(target=cleaner_thread, args=()) | |||
171 | thread.daemon = True | 172 | thread.daemon = True |
172 | thread.start() | 173 | thread.start() |
173 | 174 | ||
175 | try: | ||
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')) | ||
182 | except: | ||
183 | stderr.write("Error: Basedir not accessible\n") | ||
184 | exit(1) | ||
185 | |||
174 | if __name__ == "__main__": | 186 | if __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") |