コード例 #1
0
    def load_modes(self):
        print "loading modes..."
        got_a_mode = False  # at least one mode
        mode_folders = sorted(helpers.get_immediate_subdirectories(
            self.MODES_PATH),
                              key=lambda s: s.lower())

        for mode_folder in mode_folders:
            mode_name = str(mode_folder)
            mode_path = self.MODES_PATH + mode_name + '/main.py'
            print mode_path
            try:
                imp.load_source(mode_name, mode_path)
                self.mode_names.append(mode_name)
                got_a_mode = True
            except Exception, e:
                print traceback.format_exc()
コード例 #2
0
    def load_modes(self):
        print("loading modes...")
        got_a_mode = False  # at least one mode
        mode_folders = sorted(helpers.get_immediate_subdirectories(
            self.MODES_PATH),
                              key=lambda s: s.lower())
        print("THE MODES: ", self.MODES_PATH)
        for mode_folder in mode_folders:

            mode_name = str(mode_folder)
            mode_path = self.MODES_PATH + mode_name + '/main.py'
            try:
                imp.load_source(mode_name, mode_path)
                self.mode_names.append(mode_name)
                got_a_mode = True
            except Exception as e:
                print("EXCEPTION IS THROWN ", traceback.format_exc())
        return got_a_mode
コード例 #3
0
import homepage
import traceback

APPS_PATH = '../apps/'

# global config
cherrypy.config.update({
    'environment': 'production',
    'log.error_file': '/tmp/site.log',
    'log.screen': True,
    'server.socket_host': '0.0.0.0',
    'server.socket_port': 80,
})
# load apps
print "loading apps..."
app_folders = sorted(helpers.get_immediate_subdirectories(APPS_PATH),
                     key=lambda s: s.lower())
apps = []
for app_folder in app_folders:
    app_name = str(app_folder)
    app_path = APPS_PATH + app_name + '/app.py'
    print 'loading: ' + app_path
    try:
        app = imp.load_source(app_name, app_path)
        cherrypy.tree.mount(app.Root(), app.base, app.config)
        apps.append(app)
    except Exception, e:
        print traceback.format_exc()

# load home
cherrypy.tree.mount(homepage.Root(apps), homepage.base, homepage.config)
コード例 #4
0
import homepage
import traceback

APPS_PATH = '../apps/'
APPS_PATH_USER = '******'

# global config
cherrypy.config.update({    'environment': 'production',
                            'log.error_file': '/tmp/site.log',
                            'log.screen': True,
                            'server.socket_host': '0.0.0.0',
                            'server.socket_port': 80,
                        })
# load apps
print "loading apps..."
app_folders = sorted(helpers.get_immediate_subdirectories(APPS_PATH), key=lambda s: s.lower() )
apps = []
for app_folder in app_folders :
    app_name = str(app_folder)
    app_path = APPS_PATH+app_name+'/app.py'
    print 'loading: ' + app_path
    try :
        app = imp.load_source(app_name, app_path)
        cherrypy.tree.mount(app.Root(), app.base, app.config)
        apps.append(app)
    except Exception, e:
        print traceback.format_exc()

print "loading user apps..."
app_folders = sorted(helpers.get_immediate_subdirectories(APPS_PATH_USER), key=lambda s: s.lower() )
for app_folder in app_folders :