コード例 #1
0
ファイル: startup.py プロジェクト: jelford/reef
def setupConfig(proj_dir, base_dir):
    """
    Setup the :mod:`config` module using the config file that will be or is in
    the project directory.

    The project and base directories will only be stored if the config is new.

    :param proj_dir: The absolute path to the project directory.
    :type proj_dir: ``str``
    :param base_dir: The absolute path to the base (server installation) 
                     directory.
    :type base_dir: ``str``
    :returns: ``True`` if there was not an existing config file. (i.e. this was
              a new configuration.)
    :rtype: ``bool``

    """

    config_file = os.path.join(proj_dir, pb.appname_file+".config")
    print "Using " + config_file + " as the config file."
    config.setConfig(config_file)

    new_config = not config.onDisk()

    if new_config:
        print "Storing essential directories."
        config.getSettings("global")["basedir"] = base_dir
        config.getSettings("global")["projdir"] = proj_dir
    else:
        print "Config Loaded."

    return new_config
コード例 #2
0
ファイル: startup.py プロジェクト: OhBaby/reef
except KeyboardInterrupt:
    print "\nBye Bye..."
    sys.exit()

print "Oh good, let's continue then"

show_break()

# Load / Create config

config_file = os.path.join(proj_dir, pb.appname_file+".config")
print "Using " + config_file + " as the config file."

config.setConfig(config_file)

new_config = not config.onDisk()

config.getSettings("global")["basedir"] = base_dir

if new_config:
    config.getSettings("global")["projdir"] = proj_dir
else:
    print "Config Loaded"

show_break()

# Security Setup

# Has to be imported after config is set up
import security