def bootstrap(): basePath = os.path.dirname(os.path.abspath(__file__)) config_file = basePath + '/config/mematool.conf' config = ConfigParser() if not os.path.isfile(config_file): raise ConfigException('Could not find config file ' + config_file + ' in ' + getcwd()) config.read(config_file) Config.basePath = basePath Config(config) Config.instance.db = setup_db()
def bootstap(): basePath = os.path.dirname(os.path.abspath(__file__)) config_file = basePath + '/config/mematool.conf' config = ConfigParser() if not os.path.isfile(config_file): raise ConfigException('Could not find config file ' + config_file + ' in ' + getcwd()) config.read(config_file) Config.basePath = basePath Config(config) wsgi_config = basePath + '/config/cherrypy.conf' cherrypy.config.update(config=wsgi_config) cherrypy_config = { 'tools.staticdir.on': True, 'tools.staticdir.root': basePath + "/htdocs", 'tools.staticdir.dir': "", 'tools.sessions.on': True, 'tools.sessions.storage_type': 'file', 'tools.sessions.storage_path': basePath + '/sessions', 'tools.sessions.timeout': 60, } cherrypy.config.update(cherrypy_config) cherrypy.tools.I18nTool = I18nTool(basePath) cherrypy.tools.require_auth = cherrypy.Tool('before_handler', require_auth) # DB stuff SAEnginePlugin(cherrypy.engine).subscribe() cherrypy.tools.db = SATool() cherrypy.tree.mount(IndexController(), '/') cherrypy.tree.mount(ProfileController(), '/profile') cherrypy.tree.mount(MembersController(), '/members') cherrypy.tree.mount(PaymentsController(), '/payments') cherrypy.tree.mount(MailsController(), '/mails') cherrypy.tree.mount(GroupsController(), '/groups') cherrypy.tree.mount(StatisticsController(), '/statistics') cherrypy.tree.mount(PreferencesController(), '/preferences')