Ask Your Question

Personalizing the notebook

asked 2011-09-18 14:16:51 +0200

mmarco gravatar image

I am running two notebook servers in the same machine and i want to personalize them (mainly the login screen, and maybe also some translation). I have seen that putting a notebook.css in the $HOME/.sage/ directory i can customize the colors. Also, editing the files in /devel/sagenb-main/sagenb/data/sage/html/ i can personalize the login screen and so on.

My question is: can i do it on a per-notebook basis? Is there some location in the $HOME/.sage/sage_notebook-sagenb/ directory where i can copy the modified files in order to affect that specific notebook?.

I know that, in the worst case, i would do it by copying the whole sage instalation and making the different changes in the two directories, but i would prefear to find a solution that doesn't imply duplicating the instalation.

edit retag flag offensive close merge delete


I finally did it using javascript. It's not an elegant solution, but it works.

mmarco gravatar imagemmarco ( 2011-09-20 10:06:07 +0200 )edit

Can you post your "answer", or a bit more details about how you did it, as an actual answer? Also, can you open a trac ticket to add this feature? I think it would be great if we could customize each notebook by putting something in the sage_notebook.sagenb directory.

Jason Grout gravatar imageJason Grout ( 2011-09-20 11:33:54 +0200 )edit

2 Answers

Sort by ยป oldest newest most voted

answered 2011-09-21 19:50:18 +0200

If you are using the flask notebook you can use the SAGENB_TEMPLATE_PATH environment variable to specify the directory to search for the html templates and stylesheets.

Here is the changeset.

edit flag offensive delete link more


Thanks. Is the flask notebook ready for real use already? When is it expected to substitute the traditional one? And finally: where does the SAGENB_TEMPLATE_PATH must be set?

mmarco gravatar imagemmarco ( 2011-09-22 06:39:55 +0200 )edit

Before starting Sage, you should set SAGENB_TEMPLATE_PATH to a directory which contains a customized version of the contents of the sagenb/data/sage dir from the notebook repository.

burcin gravatar imageburcin ( 2011-09-22 09:23:53 +0200 )edit

Where, in a recent sage release, is SAGENB_TEMPLATE_PATH set ? How is it set to sagenb/data/sage ?

Pedro gravatar imagePedro ( 2012-01-05 09:44:37 +0200 )edit

Pedro, the patch with SAGENB_TEMPLATE_PATH was only merged in the flask notebook AFAIK. There is still ongoing work to include this in Sage-5.0.

burcin gravatar imageburcin ( 2012-01-18 04:43:42 +0200 )edit

answered 2011-09-21 18:49:20 +0200

mmarco gravatar image

What i did was basically include this:

<script type="text/javascript">
if (location.href=='url1')

if (location.href=='url2')

in /devel/sagenb-main/sagenb/data/sage/html/login.html, where url1 and url2 are the complete urls of each notebook, and content1 and content2 the contents you want the paage to show in each case.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools


Asked: 2011-09-18 14:16:51 +0200

Seen: 771 times

Last updated: Sep 21 '11