def _match_handler(self, url): """ Load script handler configurations from app.yaml and try to match the provided url path to a url_maps regex. """ app_yaml_path = os.path.join(get_application_root(), "app.yaml") config = ModuleConfiguration(app_yaml_path) url_maps = config.handlers script_handlers = [ _ScriptHandler(maps) for maps in url_maps if maps.GetHandlerType() == appinfo.HANDLER_SCRIPT ] for handler in script_handlers: if handler.match(url): return handler raise AssertionError('No handler found for {url}'.format(url=url))
def check_deferred_builtin(app_configs=None, **kwargs): """ Check that the deferred builtin is switched off, as it'll override Djangae's deferred handler """ from google.appengine.tools.devappserver2.application_configuration import ModuleConfiguration app_yaml_path = os.path.join(get_application_root(), "app.yaml") config = ModuleConfiguration(app_yaml_path) errors = [] for handler in config.handlers: if handler.url == '/_ah/queue/deferred': if handler.script == 'google.appengine.ext.deferred.application': errors.append( Warning( "Deferred builtin is switched on. This overrides Djangae's deferred handler", hint='Remove deferred builtin from app.yaml', id='djangae.W001')) break return errors