From 7267f1666520f1356fcb04f5f4f85ff99a238c61 Mon Sep 17 00:00:00 2001 From: Philippe Duval Date: Thu, 2 Aug 2018 17:30:18 -0400 Subject: [PATCH] Set the requests_pathname_prefix if `DASH_APP_NAME` env present. --- dash_auth/auth.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/dash_auth/auth.py b/dash_auth/auth.py index 3a65946..640b772 100644 --- a/dash_auth/auth.py +++ b/dash_auth/auth.py @@ -1,4 +1,7 @@ from __future__ import absolute_import + +import os + from abc import ABCMeta, abstractmethod from six import iteritems, add_metaclass @@ -10,7 +13,9 @@ def __init__(self, app): self._index_view_name = app.config['routes_pathname_prefix'] self._overwrite_index() self._protect_views() - self._index_view_name = app.config['routes_pathname_prefix'] + app_name = os.getenv('DASH_APP_NAME') + if app_name: + app.config['requests_pathname_prefix'] = '/{}/'.format(app_name) def _overwrite_index(self): original_index = self.app.server.view_functions[self._index_view_name]