-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstart_servers.sh
More file actions
executable file
·30 lines (24 loc) · 1.27 KB
/
start_servers.sh
File metadata and controls
executable file
·30 lines (24 loc) · 1.27 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#!/bin/bash
# Create a Jupyter configuration directory if it doesn't exist
mkdir -p ~/.jupyter
# Create or overwrite the jupyter_notebook_config.py file to automatically clear outputs on save
cat <<EOL > ~/.jupyter/jupyter_notebook_config.py
import nbformat
from nbconvert.preprocessors import ClearOutputPreprocessor
def clear_output_pre_save(model, **kwargs):
"""Automatically clears output before saving notebooks."""
if model['type'] == 'notebook':
notebook_content = model['content']
preprocessor = ClearOutputPreprocessor()
preprocessor.preprocess(notebook_content, {})
# Configure the post-save hook to clear output cells
c.FileContentsManager.pre_save_hook = clear_output_pre_save
# Ensure that the default FileContentsManager is used
c.NotebookApp.contents_manager_class = "notebook.services.contents.filemanager.FileContentsManager"
EOL
# Start Jupyter Notebook server in the background with additional settings for embedding
jupyter notebook --ip=0.0.0.0 --port=8888 --no-browser --allow-root --NotebookApp.token='' --NotebookApp.password='' \
--NotebookApp.tornado_settings="{'headers':{'Content-Security-Policy':\"frame-ancestors 'self' http://localhost:3001\"}}" &
# Start React development server in the foreground
cd /usr/src/app/gui
npm start