示例#1
0
#print("sys.path: {0}".format(sys.path))
#print("os.environ[PYTHONPATH]: {}".format(os.environ["PYTHONPATH"]))
# END TEMP

# Config
from config.serverParams import serverParameters
# For configuring logger
from processRuns import utilities

# By not setting a name, we get everything!
logger = logging.getLogger("")
# Alternatively, we could set "webApp" to get everything derived from that
#logger = logging.getLogger("webApp")

# Setup logger
utilities.setupLogging(logger, serverParameters.loggingLevel, serverParameters.debug, "webApp")
# Log server settings
logger.info(serverParameters.printSettings())

# Imports are below here so that they can be logged
from webApp.webApp import app

# Set the secret key here
if not serverParameters.debug:
    # Connect to database ourselves and grab the secret key
    (dbRoot, connection) = utilities.getDB(serverParameters.databaseLocation)
    if dbRoot["config"].has_key("secretKey") and dbRoot["config"]["secretKey"]:
        logger.info("Setting secret key from database!")
        secretKey = dbRoot["config"]["secretKey"]
    else:
        # Set secret_key based on sensitive param value
示例#2
0
print("parentFolder: ", parentFolder)
# Adds to the import path
sys.path.insert(0, parentFolder)
# Sets the execution folder
os.chdir(parentFolder)

# Server configuration
from config.processingParams import processingParameters
from config import sensitiveParams

# Get the most useful fucntions
from processRuns import utilities

import logging
# By not setting a name, we get everything!
logger = logging.getLogger("")
# Alternatively, we could set processRuns to get everything derived from that
#logger = logging.getLogger("processRuns")

# Setup logging
utilities.setupLogging(logger, processingParameters.loggingLevel, processingParameters.debug, "processRuns")
# Log settings
logger.info(processingParameters.printSettings())

if __name__ == "__main__":
    (db, connection) = utilities.getDB(processingParameters.databaseLocation)
    utilities.updateDBSensitiveParameters(db = db, debug = processingParameters.debug)

    # Close the database connection
    connection.close()