From 2b268eb0897825bba13ff963f58b348a96a4ce21 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gregor=20M=C3=BCllegger?= Date: Fri, 24 May 2013 13:59:53 +0200 Subject: [PATCH] Setting up autodoc for the docs. For this to work you need to install sphinx in your virtualenv. It's added to the requirements.txt so just run: pip install -r requirements.txt --- docs/README | 7 +++++-- docs/conf.py | 9 ++++++++- requirements.txt | 1 + 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/docs/README b/docs/README index 05133d8..3169cbf 100644 --- a/docs/README +++ b/docs/README @@ -6,10 +6,13 @@ This allows it to be built into other forms for easier viewing and browsing. To create an HTML version of the docs: -* Install Sphinx (using ``sudo pip install Sphinx`` or some other method) +* Create a virtualenv and activate it. + +* Install all dependencies from requirements.txt inot the virtualenv using + ``pip install -r requirements.txt`` (this will also install Sphinx). * In this docs/ directory, type ``make html`` (or ``make.bat html`` on - Windows) at a shell prompt. + Windows) at a shell prompt while the virtualenv is active. The documentation in _build/html/index.html can then be viewed in a web browser. diff --git a/docs/conf.py b/docs/conf.py index 2d20388..80a70c1 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -16,7 +16,14 @@ import sys, os # If extensions (or modules to document with autodoc) are in another directory, # add these directories to sys.path here. If the directory is relative to the # documentation root, use os.path.abspath to make it absolute, like shown here. -#sys.path.insert(0, os.path.abspath('.')) +project_directory = os.path.dirname( + os.path.dirname(os.path.abspath(__file__))) + +# having the example project first, so that the settings module will be found +sys.path.insert(0, os.path.join(project_directory, 'example')) +sys.path.insert(1, project_directory) + +os.environ.setdefault("DJANGO_SETTINGS_MODULE", "example.settings") # -- General configuration ----------------------------------------------------- diff --git a/requirements.txt b/requirements.txt index 86357b2..7cd0fea 100644 --- a/requirements.txt +++ b/requirements.txt @@ -6,3 +6,4 @@ coverage==3.6 django-coverage==1.2.2 django-extra-views==0.6.2 django-floppyforms==1.1 +Sphinx==1.2b1