This documentation is for Dash Enterprise.
Dash Enterprise is the fastest way to write & deploy Dash apps and
Jupyter notebooks.
10% of the Fortune 500 uses Dash Enterprise to productionize AI and
data science apps. Find out if your company is using Dash Enterprise.
Local directory mapping is available for Dash Enterprise Single Server versions 2.5.0 to 4.3.0. This page applies to Dash Enterprise 4.
In Dash Enterprise, Dash apps are run in isolated containers. Dash Enterprise builds the entire system for each individual app from scratch, including installing a fresh instance of Python, installing dependencies, and more. This isolation and containerization is great: it allows for one app’s dependencies to not impact the next app’s and, from a security perspective, ensures that apps can’t modify or access the underlying server. One part of this isolation is that each app has its own “ephemeral” filesystem. This means that:
Mapping filesystems from the underlying server into the app allows you to save files
persistently as well as read files from the underlying server, including networked file systems.
Because this feature has security implications, only directories specified in the Dash Enterprise Server Manager can be mapped to Dash apps.
A server administrator with access to https://<your.plotly.domain>:8800/settings
can allow certain directories on the host server to be mapped to Dash apps. Go to the Allowed Directories for Mapping section of the settings page and enter the path(s) of approved directories.
To add a directory mapping via the Dash Enterprise UI,
navigate to the app Settings and scroll down to
Directory Mappings. Here, use the text boxes to
add the Host Path and App Path. For example, /srv/app-data
and /data
.
<img>
If the directory you’re trying to map from isn’t admin-approved, you will see an error
message.
<img>
If you have mapped the directory from /srv/app-data
to /data
, then you
can read files from this folder in your app with the following code:
import os
file_pathname = os.path.join(os.sep, 'data', 'my-dataset.csv')
In some cases, the filesystems that you reference in your deployed
app may be different from those that you reference locally.
In your app code, you can check which environment you are in
with the following code:
if 'DASH_APP_NAME' in os.environ:
# this is a deployed app
filepath = os.path.join(os.sep, 'data', 'my-dataset.csv')
else:
# local file path
filepath = os.path.join(os.sep, 'Users', 'chris', 'data', 'my-dataset.csv')
If you are mounting a filesystem, we have the following recommendations:
/usr
./srv
folder would be a good, conventional place/etc/fstab
file on the underlying server. For moreTo remove directory mappings via the Dash Enterprise UI, select Delete.
<img>