Hello there!
I’m trying to build an interactive book. Currently I’ve built a webpage in django with a user registration system. I’ve also built a basic book using sphinx and the pydata-sphinx-theme.
Now my problem is the following, when I ‘make’ the html files from my markdown pages in sphinx I get 10+ html files, each file containing (hardcoded) cross references to one of the other files. I can probably change the links to dynamic links by creating sphinx templates, but how do I import all these files in django? Should I create a django view for every html page from sphinx ? Or is there possibly some jinja magic I could perform ? all html pages should live in one singe app (e.g.: /book/ch1.html#par1, /book/ch1.html#parX, /book/ch2.html#par1, /book/chX.html#parX, etc), so there probably would be some smart way of doing this ?
Also, I have failed to find any tutorials on building sphinx into django, however there are numerous websites online who function by doing this (I suspect even the documentation page of django uses sphinx). Am I maybe using the wrong google search terms ?
I hope anyone can point me in the right direction here?
Currently my django views looks like this:
from django.shortcuts import render
#login_required
from django.contrib.auth.decorators import login_required
# Create your views here.
@login_required
def home(request):
context = {
'title': 'Book'
}
return render(request, 'book/home.html', context)
@login_required
def statics(request):
context = {
'title': 'Statics'
}
#How to import 10 chapters of sphinx html documents here ?
return render(request, 'book/statics.html', context)
and one of the example sphinx files (a placeholder page) looks like this (please note the link list of links in the sidebar at the bottom of the html as well):
tutorial.html (39.3 KB)