Skip to content

Commit 590c724

Browse files
authored
Merge pull request #289 from Zsailer/static-url-prefix-fix
make static_url_prefix configurable
2 parents 56b06d2 + 3812a23 commit 590c724

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

jupyter_server/extension/application.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -188,9 +188,13 @@ def _default_log_format(self):
188188
"""override default log format to include date & time"""
189189
return u"%(color)s[%(levelname)1.1s %(asctime)s.%(msecs).03d %(name)s]%(end_color)s %(message)s"
190190

191-
@property
192-
def static_url_prefix(self):
193-
static_url = "static/{name}".format(
191+
static_url_prefix = Unicode(
192+
help="""Url where the static assets for the extension are served."""
193+
).tag(config=True)
194+
195+
@default('static_url_prefix')
196+
def _default_static_url_prefix(self):
197+
static_url = "static/{name}/".format(
194198
name=self.name
195199
)
196200
return urljoin(self.serverapp.base_url, static_url)
@@ -429,7 +433,7 @@ def launch_instance(cls, argv=None, **kwargs):
429433
if argv is None:
430434
args = sys.argv[1:] # slice out extension config.
431435
else:
432-
args = []
436+
args = argv
433437
# Check for subcommands
434438
subapp = _preparse_for_subcommand(cls, args)
435439
if subapp:

jupyter_server/extension/handler.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,10 +56,7 @@ def base_url(self):
5656

5757
@property
5858
def static_url_prefix(self):
59-
static_url = "static/{name}".format(
60-
name=self.name
61-
)
62-
return urljoin(self.serverapp.base_url, static_url)
59+
return self.extensionapp.static_url_prefix
6360

6461
@property
6562
def static_path(self):

0 commit comments

Comments
 (0)