diff --git a/biosimdb_interface/__init__.py b/biosimdb_interface/__init__.py
index d8beb6b..582900e 100644
--- a/biosimdb_interface/__init__.py
+++ b/biosimdb_interface/__init__.py
@@ -26,13 +26,17 @@ def create_app(test_config=None):
Configured Flask app instance.
"""
# create and configure the app
+ APPLICATION_BASE = os.getenv("APPLICATION_BASE", "")
app = Flask(
__name__, # name of the current Python module
template_folder="templates", # where html files are stored.
static_folder="static", # used for css and js files.
+ static_url_path=f"{APPLICATION_BASE}/static",
instance_relative_config=True,
) # create flask instance
+ app.config["APPLICATION_BASE"] = os.getenv("APPLICATION_BASE", "")
+
# check secret key is not "dev" for prod
secret_key = os.getenv("SECRET_KEY", "dev")
if secret_key == "dev" and not app.debug:
@@ -47,6 +51,7 @@ def create_app(test_config=None):
AUTH_URL=os.getenv("AUTH_URL", ""),
TOKEN_URL=os.getenv("TOKEN_URL", ""),
BASE_URL=os.getenv("BASE_URL", ""),
+ JOOMLA_BASE_URL=os.getenv("JOOMLA_BASE_URL", "").rstrip("/"),
API_BASE=os.getenv("API_BASE", ""),
REDIRECT_URI=os.getenv("REDIRECT_URI", ""),
SCOPES=os.getenv("SCOPES", "").strip(),
@@ -61,7 +66,11 @@ def create_app(test_config=None):
@app.context_processor
def inject_base_url():
- return {"BASE_URL": app.config.get("BASE_URL") or ""}
+ return {
+ "BASE_URL": app.config.get("BASE_URL", ""),
+ "JOOMLA_BASE_URL": app.config.get("JOOMLA_BASE_URL", ""),
+ "APPLICATION_BASE": app.config.get("APPLICATION_BASE", ""),
+ }
# ensure the instance folder exists
try:
@@ -71,10 +80,10 @@ def inject_base_url():
from .form import form_bp
- app.register_blueprint(form_bp)
+ app.register_blueprint(form_bp, url_prefix=app.config["APPLICATION_BASE"])
from .login import bp as login_bp
- app.register_blueprint(login_bp)
+ app.register_blueprint(login_bp, url_prefix=app.config["APPLICATION_BASE"])
return app
diff --git a/biosimdb_interface/schema/__init__.py b/biosimdb_interface/schema/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/biosimdb_interface/static/js/form/metadata.js b/biosimdb_interface/static/js/form/metadata.js
index fe7ead0..930ed40 100644
--- a/biosimdb_interface/static/js/form/metadata.js
+++ b/biosimdb_interface/static/js/form/metadata.js
@@ -28,7 +28,7 @@ document.addEventListener('click', function(e) {
});
});
- fetch('/extract_metadata', {
+ fetch(window.APPLICATION_BASE + '/extract_metadata', {
method: 'POST',
body: formData
})
@@ -421,7 +421,7 @@ function requireExtraction(form) {
function validateAndSubmit(form, onSuccess) {
const formData = new FormData(form);
formData.append('save', '1');
- fetch('/webform', { method: 'POST', body: formData })
+ fetch(window.APPLICATION_BASE + '/webform', { method: 'POST', body: formData })
.then(r => r.json())
.then(data => {
if (data.validation_errors && data.validation_errors.length > 0) {
diff --git a/biosimdb_interface/templates/form/webform.html b/biosimdb_interface/templates/form/webform.html
index 5911eb0..7d5be19 100644
--- a/biosimdb_interface/templates/form/webform.html
+++ b/biosimdb_interface/templates/form/webform.html
@@ -29,7 +29,7 @@
+
+
+
+
+
+
{% for meta_section, meta_group in simulation_metadata.items() %}
diff --git a/biosimdb_interface/templates/main/base.html b/biosimdb_interface/templates/main/base.html
index 34d8a0a..809cf76 100644
--- a/biosimdb_interface/templates/main/base.html
+++ b/biosimdb_interface/templates/main/base.html
@@ -1,5 +1,4 @@
{#
- base.html
Site-wide base template. All other templates extend this.
Blocks:
@@ -9,7 +8,8 @@
Features:
- Renders flashed messages as dismissible Bootstrap alerts.
- Loads Bootstrap 5 JS bundle from CDN.
- - Includes head.html for shared content (meta, CSS, title).
+ - Includes head.html for shared content.
+ - Includes Joomla header/footer only when JOOMLA_BASE_URL is configured.
#}
@@ -19,8 +19,9 @@
{% include 'main/head.html' %}
-
+
+
{% with messages = get_flashed_messages(with_categories=true) %}
{% if messages %}
@@ -34,10 +35,33 @@
{% endif %}
{% endwith %}
- {% block content %}{% endblock %}
+ {% if JOOMLA_BASE_URL %}
+ {% include 'main/joomla_header.html' %}
+ {% endif %}
+
+
+
+ {% if JOOMLA_BASE_URL %}
+
+ {% endif %}
+
+ {% block content %}{% endblock %}
+
+
+
+ {% if JOOMLA_BASE_URL %}
+ {% include 'main/joomla_footer.html' %}
+ {% endif %}
+
+
{% block scripts %}
+
+
+
{% endblock %}
diff --git a/biosimdb_interface/templates/main/head.html b/biosimdb_interface/templates/main/head.html
index 6a1ff7b..18f1fd9 100644
--- a/biosimdb_interface/templates/main/head.html
+++ b/biosimdb_interface/templates/main/head.html
@@ -1,20 +1,19 @@
{#
- head.html
Shared partial included by base.html.
- Loads:
- - Bootstrap 5.3.2 CSS (CDN) (https://getbootstrap.com/docs/5.3/)
- - Application stylesheet (styles/styles.css)
- - Application SCSS (styles/styles.scss)
- - Page title and favicon
+ Loads core app assets. Joomla assets are included only when
+ JOOMLA_BASE_URL is configured.
#}
-
-
-
+
+
+
BioSimDB
-
- BioSimDB Interface
-
+{% if JOOMLA_BASE_URL %}
+ {% include 'main/joomla_head.html' %}
+{% endif %}
-
+
+
+
+
diff --git a/biosimdb_interface/templates/main/joomla_footer.html b/biosimdb_interface/templates/main/joomla_footer.html
new file mode 100644
index 0000000..00692ba
--- /dev/null
+++ b/biosimdb_interface/templates/main/joomla_footer.html
@@ -0,0 +1,26 @@
+{#
+ Joomla site footer.
+
+ Included only when JOOMLA_BASE_URL is configured.
+#}
+
+
+
+
+
+
diff --git a/biosimdb_interface/templates/main/joomla_head.html b/biosimdb_interface/templates/main/joomla_head.html
new file mode 100644
index 0000000..6fc1c28
--- /dev/null
+++ b/biosimdb_interface/templates/main/joomla_head.html
@@ -0,0 +1,63 @@
+{#
+ Joomla assets.
+
+ Included only when JOOMLA_BASE_URL is configured.
+#}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/biosimdb_interface/templates/main/joomla_header.html b/biosimdb_interface/templates/main/joomla_header.html
new file mode 100644
index 0000000..a7ce162
--- /dev/null
+++ b/biosimdb_interface/templates/main/joomla_header.html
@@ -0,0 +1,48 @@
+{#
+ Joomla site header.
+
+ Included only when JOOMLA_BASE_URL is configured.
+#}
+
+
diff --git a/tests/conftest.py b/tests/conftest.py
index 872c36f..421de93 100644
--- a/tests/conftest.py
+++ b/tests/conftest.py
@@ -21,6 +21,7 @@ def app():
"BASE_URL": "http://localhost",
"REDIRECT_URI": "http://localhost/callback",
"SCOPES": "test",
+ "APPLICATION_BASE": "",
}
)
yield app