-def paste_app_factory(global_config, **kw):
- # Get the database connection
- connection = mongokit.Connection(
- kw.get('db_host'), kw.get('db_port'))
-
- # Set up the storage systems.
- public_store = storage.storage_system_from_paste_config(
- kw, 'publicstore')
- queue_store = storage.storage_system_from_paste_config(
- kw, 'queuestore')
-
- # Set up the staticdirect system
- if kw.has_key('direct_remote_path'):
- staticdirector = staticdirect.RemoteStaticDirect(
- kw['direct_remote_path'].strip())
- elif kw.has_key('direct_remote_paths'):
- staticdirector = staticdirect.MultiRemoteStaticDirect(
- dict([line.strip().split(' ', 1)
- for line in kw['direct_remote_paths'].strip().splitlines()]))
- else:
- raise ImproperlyConfigured(
- "One of direct_remote_path or direct_remote_paths must be provided")
-
- mgoblin_app = MediaGoblinApp(
- connection, kw.get('db_name', 'mediagoblin'),
- public_store=public_store, queue_store=queue_store,
- staticdirector=staticdirector,
- user_template_path=kw.get('local_templates'))