Eddy Mulyono ([info]eddymulyono) wrote,

HOWTO build a local copy of Django documentation under Ubuntu Hardy

$ apt-get install python-pygments python-jinja python-docutils python-setuptools
$ sudo easy_install Sphinx

(I should package python-sphinx)

$ svn co http://code.djangoproject.com/svn/django/trunk/docs/ django-docs
$ cd django-docs
$ make

(I should also package python-django-doc)

Edit: Anonymous reminded me that issuing `make` will only list possible output formats. To actually build the documentation in HTML, I should've issued `make html`. Thanks, Anonymous.

Edit 2 on 2010-Jan-9: Simeon pointed out that, with the advent of virtualenv, things can be as simple as:

$ virtualenv ENV # if needed, sudo apt-get install virtualenv
$ source ENV/bin/activate
$ easy_install Sphinx
$ make html

Thanks, Simeon.

Tags: django, tech, ubuntu

  • Post a new comment

    Error

  • 10 comments

[info]ravli

May 31 2008, 12:47:14 UTC 3 years ago

Thanks, that looks great!

Anonymous

May 31 2008, 16:12:20 UTC 3 years ago

only make don't work

/tmp/django-docs $ make
Please use `make ' where is one of
html to make standalone HTML files
web to make files usable by Sphinx.web
htmlhelp to make HTML files and a HTML help project
latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter
changes to make an overview over all changed/added/deprecated items
linkcheck to check all external links for integrity

[info]eddymulyono

May 31 2008, 21:17:34 UTC 3 years ago

Re: only make don't work

Oops. I forgot that `make` requires an extra argument. Try `make html`.

PS: Thanx for reminding me. I've added a footnote to my post accordingly.

Anonymous

June 26 2008, 02:40:03 UTC 3 years ago

Re: don't work yet

WARNING: /home/jjlorenzo/workspace/django/docs/distributions.txt:: document isn't included in any toctree WARNING: /home/jjlorenzo/workspace/django/docs/form_for_model.txt:: document isn't included in any toctree WARNING: /home/jjlorenzo/workspace/django/docs/forms.txt:: document isn't included in any toctree writing output... add_ons admin_css Exception occurred: File "/usr/lib/python2.5/site-packages/Sphinx-0.4-py2.5.egg/sphinx/builder.py", line 143, in post_process_images self.images[candidate] = self.env.images[candidate][1] KeyError: u'http://media.djangoproject.com/img/doc/admincss/module.gif' The full traceback has been saved in /tmp/sphinx-err-ssTNi8.log, if you want to report the issue to the author. Please also report this if it was a user error, so that a better error message can be provided next time. Send reports to sphinx-dev@googlegroups.com. Thanks!

[info]eddymulyono

July 20 2008, 16:13:50 UTC 3 years ago

Re: don't work yet

I wasn't able to reproduce this.

Anonymous

July 19 2008, 15:14:55 UTC 3 years ago

Re: only make don't work

Hi. I prefer printed docs, unfortunately failed when 'make latex'. Something about empty latex_documents (conf.py). Tried sphinx-quickstart, but it only add 'index' there, not other .txt. Was i missed something? TIA.

apit, http://cikustudio.com

[info]eddymulyono

July 20 2008, 16:23:00 UTC 3 years ago

Re: only make don't work

> Was i missed something?

No, you didn't. Looking at docs/conf.py, the LaTeX section are all commented. I think the Django developers is not focusing on this feature just yet.

Just for fun, I edited docs/conf.py, uncommenting latex_documents to the following:

latex_documents = [(master_doc, 'master_doc', '', 'adrian and jacobkm', 'manual', False)]

and got as far as

eddymul@bregalad:~/Desktop/lab/docs$ make latex
mkdir -p _build/latex _build/doctrees
sphinx-build -b latex -d _build/doctrees . _build/latex
Sphinx v0.3, building latex
trying to load pickled env... done
building [latex]: all documents
updating environment: 0 added, 0 changed, 0 removed
processing master_doc... index overview install tutorial01 tutorial02 tutorial03 tutorial04 faq documentation django-admin model-api db-api transactions templates templates_python newforms modelforms testing sessions cache settings url_dispatch request_response generic_views authentication shortcuts unicode pagination serialization i18n middleware custom_model_fields databases add_ons contenttypes csrf databrowse flatpages form_preview form_wizard localflavor redirects sites sitemaps syndication_feeds webdesign modpython fastcgi apache_auth static_files email legacy_databases outputting_pdf outputting_csv design_philosophies contributing admin_css api_stability release_notes_0.96 release_notes_0.95
resolving references...
writing... WARNING: malformed reference target found: ../
WARNING: malformed reference target found: ../syndication_feeds/
WARNING: malformed reference target found: ../tutorial01/
WARNING: malformed reference target found: ../modpython/
WARNING: malformed reference target found: ../databases/
WARNING: malformed reference target found: ../databases/#oracle-notes
WARNING: malformed reference target found: ../testing/
Exception occurred:
File "/usr/lib/python2.5/site-packages/Sphinx-0.3-py2.5.egg/sphinx/latexwriter.py", line 953, in unknown_visit
raise NotImplementedError("Unknown node: " + node.__class__.__name__)
NotImplementedError: Unknown node: admonition
The full traceback has been saved in /tmp/sphinx-err-qP0B7n.log, if you want to report the issue to the author.
Please also report this if it was a user error, so that a better error message can be provided next time.
Send reports to sphinx-dev@googlegroups.com. Thanks!
make: *** [latex] Error 1

Feel free to play around with Sphinx, and if you got things working, let me/us know.

Anonymous

August 1 2008, 18:46:57 UTC 3 years ago

Re: only make don't work

Hey guys,

Thanks for pointing me in the right direction.
I got a little further and I have a pdf file to print now ;)


In docs/conf.py
I uncommented paper_size, font_size

and then entered the following line for latex_documents

latex_documents = [ (master_doc, 'master_doc.tex', "DJANGO DOCS", "Django people", "manual") ]

"build latex" then complained about a lot of malformed links... but at least i have somethign to read.... 500 pages! Good think I am the sysadmin here and I control the printing quota :)


ivan _sqigglia_ alexhs _smallcircularobject_ com

BUG: Some tables with properties are too narrow -- i don't consider this to be the perfect final product so I will not be printing it today.

Anonymous

August 20 2008, 10:00:24 UTC 3 years ago

Re: only make don't work

Thanks for that :)
I get the same errors, but it builds nice.

Anonymous

November 11 2009, 15:56:41 UTC 2 years ago

If you don't want to mess up your global site-packages

FYI - if you create a virtualenv, activate it and easy_install Sphinx all the requirements you don't already have globally installed (Jinja2 and Pygments in my case) will automatically be installed in the virtualenv, leaving your global python setup alone...

From the django docs directory:

$ virtualenv ENV
$ source ENV/bin/activate
$ easy_install Sphinx
$ make html


-regards
Simeon
Create an Account
Forgot your login or password?
Facebook Twitter More login options
English • Español • Deutsch • Русский…