From 0bbcda16e06a34376aa0800a92f8201c90f53692 Mon Sep 17 00:00:00 2001 From: Cédric Picard Date: Mon, 18 Sep 2017 09:46:08 +0200 Subject: Removes useless comments, create tmp dir if needed --- shareit/shareit.py | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/shareit/shareit.py b/shareit/shareit.py index 4d0dbb6..c9aec98 100755 --- a/shareit/shareit.py +++ b/shareit/shareit.py @@ -6,21 +6,12 @@ import json import io import os import jinja2 -import tempfile from pathlib import Path -#from bottle import Jinja2Template as Template -#from bottle import SimpleTemplate as Template - DEV_FILES_DIR = '/tmp/files' PROD_FILES_DIR = '/files' FILES_DIR = PROD_FILES_DIR -# load templates -#templates = {} -#for template in ['propose_upload', 'upload']: -# with open(Path('templates', template + '.html').as_posix(), 'r') as fi: -# templates[template] = Template(fi.read(), lookup='./templates/') templates = jinja2.Environment( loader=jinja2.FileSystemLoader('templates')) @@ -92,7 +83,10 @@ def robot(): if __name__ == '__main__': print('I: Starting shareit application as development server') FILES_DIR = DEV_FILES_DIR - #bottle.run(host='0.0.0.0', port=8080) + try: + os.mkdir(FILES_DIR) + except FileExistsError: + pass bottle.run(host='0.0.0.0', port=8080, debug=True) else: print('I: Starting shareit application as module or wsgi application') -- cgit v1.2.3