Using runestone with existing sphinx project

22 views
Skip to first unread message

Senthil Kumaran

unread,
Aug 21, 2018, 2:29:47 PM8/21/18
to RunestoneInteractive
I followed the instructions given here


to use RuneStone directly with an existing sphinx project of mine


I used the activecode directive and in a simple example .rst file and tried to build it. It resulted in this error.


Exception occurred:
  File "/Users/senthil/py/virtualenvironments/sphinx-runestone/lib/python2.7/site-packages/runestone/activecode/activecode.py", line 350, in run
    course_name = env.config.html_context['course_id']
KeyError: 'course_id'



I see that in the runestone setup itself, this is populated via paver, how do we give this variable in sphinx?

Is using runestone components directly with sphinx a good idea? OR would I be better off to use runestone as documented and port my _static .rst files to the runestone created directory?

Thanks in advance.

Senthil

Brad Miller

unread,
Aug 21, 2018, 2:55:18 PM8/21/18
to RunestoneInteractive
In looking at the error message, you are definitely missing a few template variables including the course_id variable.  A sphinx-build looks like this for a typical project:

sphinx-build -b html -d ././build/fopp/doctrees -c . -Acourse_id=fopp -Alogin_required=false -Aappname=runestone -Aloglevel=10 -Acourse_url=http://127.0.0.1:8000 -Ause_services=true -Apython3=true -Adburl=postgresql://bradleymiller:@localhost/bmiller -Adefault_ac_lang=python -Abasecourse=fopp -Adownloads_enabled=false -Aenable_chatcodes=false -Arunestone_version=3.2.0 -Abuild_info=unknown ./_sources ./build/fopp

I believe you could add many of the -Axxxx variables to your current Makefile using the SPHINXOPTS variable.  Or if you plan to incorporate a lot of the runestone components into your project you may find the runestone command (with accompanying pavement.py) file will work more easily.

Brad
--
You received this message because you are subscribed to the Google Groups "RunestoneInteractive" group.
To unsubscribe from this group and stop receiving emails from it, send an email to runestoneinterac...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Senthil Kumaran

unread,
Aug 21, 2018, 9:45:44 PM8/21/18
to RunestoneInteractive
Hello Brad,

Thanks for the reponse.

I got it to build.  


I am assuming in order to really use the features of runstone like .. activecode:: and ..mchoice:: directives, I will need to have the database backend. Is that correct?

pip install runestone in your sphinx project is not really a sphinx extension to include ..activecode:: ..mchoice:: and other components that runestone provides. If we want to use it, we have to use runestone entirely, including setting up the server. Is that correct?


Thank you,
Senthil

To unsubscribe from this group and stop receiving emails from it, send an email to runestoneinteractive+unsub...@googlegroups.com.

Brad Miller

unread,
Aug 22, 2018, 8:16:51 AM8/22/18
to RunestoneInteractive
Glad you got it to build.

You do not need the runestone server or the database in order to build a fully functioning book with all of the different components.  You can build the book and host it as a static website on any server.  That is why runestone init gives you the option to use runestone services or not.

However, without using runestone services on the backend then your students will not be able to save their work, and you will not be able to use the assignment and grading features or be able to track their progress.

Brad
To unsubscribe from this group and stop receiving emails from it, send an email to runestoneinterac...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages