aboutsummaryrefslogtreecommitdiff
path: root/src/pydrilla
diff options
context:
space:
mode:
Diffstat (limited to 'src/pydrilla')
-rw-r--r--src/pydrilla/development_config.json24
-rw-r--r--src/pydrilla/pydrilla.py7
2 files changed, 5 insertions, 26 deletions
diff --git a/src/pydrilla/development_config.json b/src/pydrilla/development_config.json
deleted file mode 100644
index 1660edb..0000000
--- a/src/pydrilla/development_config.json
+++ /dev/null
@@ -1,24 +0,0 @@
-// SPDX-License-Identifier: CC0-1.0
-
-// Hydrilla development config file.
-//
-// Copyright (C) 2021 Wojtek Kosior
-//
-// Available under the terms of Creative Commons Zero v1.0 Universal.
-
-// this config is meant to be used in development environment;
-// unlike config.json, it shall not be included in distribution
-{
- "content_dir": "./example_content",
-
- // Except files from content_dir to be served there (used to redirect
- // clients).
- "static_resource_uri": "http://localhost:8000/",
-
- // Make Pydrilla error out on any warning
- "werror": true
-
- // With the below we can make Pydrilla look for missing content items in
- // another instance instead of just erroring/warning.
- // ,"hydrilla_parent": "https://api.hachette-hydrilla.org/0.2/"
-}
diff --git a/src/pydrilla/pydrilla.py b/src/pydrilla/pydrilla.py
index 239267e..2c4ad0d 100644
--- a/src/pydrilla/pydrilla.py
+++ b/src/pydrilla/pydrilla.py
@@ -541,7 +541,6 @@ def load_content_from_subdir(subdir_path, source_name, content):
content.process_index(index, source_name)
def load_content(path):
- path = pathlib.Path(path)
if not path.is_dir():
raise ValueError(_('content_dir_path_not_dir'))
@@ -586,8 +585,12 @@ def create_app(config_path=(here / 'config.json'), flask_config={}):
app._pydrilla_werror = config.get('werror', False)
if 'hydrilla_parent' in config:
raise MyNotImplError('hydrilla_parent', config_path.name)
+
+ content_dir = pathlib.Path(config['content_dir'])
+ if not content_dir.is_absolute():
+ content_dir = config_path.parent / content_dir
with app.app_context():
- app._pydrilla_content = load_content(config['content_dir'])
+ app._pydrilla_content = load_content(content_dir.resolve())
app.register_blueprint(bp)