mirror of
https://github.com/webrecorder/pywb.git
synced 2025-03-15 00:03:28 +01:00
config system: some fixes for auto-init, add trailing '/' for dir paths, #55
This commit is contained in:
parent
7c60bf17f7
commit
5c67782a2c
@ -105,7 +105,10 @@ def create_cdx_server_app(passed_config):
|
||||
For each collection, create a /<coll>-cdx access point
|
||||
which follows the cdx api
|
||||
"""
|
||||
config = DictChain(passed_config, DEFAULTS)
|
||||
|
||||
defaults = load_yaml_config(DEFAULT_CONFIG)
|
||||
|
||||
config = DictChain(passed_config, defaults)
|
||||
|
||||
collections = config.get('collections')
|
||||
|
||||
@ -163,7 +166,8 @@ class DirectoryCollsLoader(object):
|
||||
|
||||
fulldir = os.path.join(root_dir, thedir)
|
||||
if os.path.isdir(fulldir):
|
||||
coll[dir_key] = fulldir.rstrip('/')
|
||||
fulldir = os.path.abspath(fulldir) + os.path.sep
|
||||
coll[dir_key] = fulldir
|
||||
return True
|
||||
elif required:
|
||||
msg = 'Dir "{0}" does not exist for "{1}"'.format(fulldir, dir_key)
|
||||
@ -182,7 +186,7 @@ class DirectoryCollsLoader(object):
|
||||
self._add_if_exists(coll, root_dir, 'archive_paths', True)
|
||||
|
||||
if self._add_if_exists(coll, root_dir, 'static_path', False):
|
||||
self.static_routes['static/' + name] = coll['static_path'] + '/'
|
||||
self.static_routes['static/' + name] = coll['static_path']
|
||||
|
||||
# Add templates
|
||||
templates_dir = self.config.get('paths').get('templates_dir')
|
||||
|
Loading…
x
Reference in New Issue
Block a user