def setup(): setup_logging() # Check check if database exists, otherwise create sqlite file dbFile = get_config()['database']['location'] if path.exists(dbFile): logger.info('Using database file "%s"' % dbFile) else: logger.info('Init database on "%s"' % dbFile) init_db() # parse all workspaces already on the hard drive scan_workspaces_dir() # Start the flask server logger.info("Launch flask server")
import logging import tempfile from son_editor.util.requestutil import CONFIG logging.info("Setting up config for temporary db") # Set the temp db location handle, CONFIG['database']['location'] = tempfile.mkstemp() # import after database location has been set to a temp directory from son_editor.app.database import init_db # Testing flag to circumvent login CONFIG['testing'] = True # set workspacelocation to tempfile to avoid spamming the workspace dir CONFIG["workspaces-location"] = tempfile.mkdtemp() + '/' # Initialize db with the temp location init_db()