Skip to content

Commit c5f0227

Browse files
committed
determines asset path based on env
1 parent 682da7d commit c5f0227

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

h/assets.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,22 @@
11
"""View for serving static assets under `/assets`."""
22

3+
import os
34
import importlib_resources
45
from h_assets import Environment, assets_view
56
from pyramid.settings import asbool
67

78

9+
810
def includeme(config):
911
auto_reload = asbool(config.registry.settings.get("h.reload_assets", False))
1012
h_files = importlib_resources.files("h")
1113

14+
asset_path = "/hypothesis/assets"
15+
if "ASSET_PATH" in os.environ:
16+
asset_path = os.environ["ASSET_PATH"]
17+
1218
assets_env = Environment(
13-
assets_base_url="/hypothesis/assets",
19+
assets_base_url=asset_path,
1420
bundle_config_path=h_files / "assets.ini",
1521
manifest_path=h_files / "../build/manifest.json",
1622
auto_reload=auto_reload,

tox.ini

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ setenv =
7272
REPORT_FDW_USERS=lms-fdw report-fdw
7373
dev: PYTHONPATH = .
7474
dev: APP_URL = {env:APP_URL:http://localhost:5000}
75+
dev: ASSET_PATH = {env:ASSET_PATH:/assets}
7576
dev: WEBSOCKET_URL = {env:WEBSOCKET_URL:ws://localhost:5001/ws}
7677
dev: ENABLE_WEB = {env:ENABLE_WEB:true}
7778
dev: ENABLE_WEBSOCKET = {env:ENABLE_WEBSOCKET:true}

0 commit comments

Comments
 (0)