OK - I have a Django project that I want to document -- so I installed Sphinx. The install went fine, and I can ouput all the HTML to a _build
folder. But...
The question is: how do I actually view my documentation in a browser?
Is it assumed that the documentation will not be viewed within the Django project but in its own website? If viewed within the Django project, do I need to set up a url
pattern to handle the documentation?
I'm a little bit confused how to actually view this information in my browser within the Django project.
Sphinx is a popular tool for documenting Python projects, including the ability to generate automatic documentation using docstrings in your source code.
url(r'^docs/(?P<path>.*)$', 'django.views.static.serve', {'document_root': settings.DOCS_ROOT}),
url(r'^docs/', 'django.views.static.serve', {'document_root': settings.DOCS_ROOT, 'path': 'index.html'}),
Where settings.DOCS_ROOT is an absolute path to your docs/_build/html directory generated by Sphinx.
There's a reusable app for exactly this purpose: django-docs ;)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With