from routes.base import Mapper from routes.util import url_for, redirect_to from myghty.resolver import * from myghty.ext.routeresolver import RoutesResolver import os # This is the mapper, its responsible for setting up Routes to determine how your # controllers are called. m = Mapper() m.connect(':controller/:action/:id') root_path = os.path.dirname(os.path.abspath(__file__)) # The following options are passed directly into Myghty, so all configuration options # available to the Myghty handler are available for your use here config = {} config['use_session'] = True config['session_key'] = '${package}' config['session_secret'] = 'CHANGEME' config['log_errors'] = True if os.environ['MYGHTY_ENV'] == 'development': config['output_errors'] = True else: config['output_errors'] = False config['allow_globals'] = ['url_for', 'redirect_to'] #config['debug_elements'] = ['resolution','classloading'] #config['path_translate'] = [ (r'/your/(stuff.*)', r'/that\1) ] config['data_dir'] = root_path+'/cache/' config['component_root'] = [{'components':root_path + '/components'}, {'templates':root_path + '/templates'}, ] config['resolver_strategy'] = [ \ ConditionalGroup(context = 'request', rules = [PathTranslate(), RoutesResolver(mapper=m, controller_root=root_path+'/controllers'), NotFound(), ]), URICache(rule = ResolveFile()), ResolveDhandler(), ResolveUpwards(), ResolveFile(), NotFound() ]