コード例 #1
0
if "DJANGO_SETTINGS_MODULE" not in os.environ:
    docs_path = os.getcwd()
    parts = (docs_path, "..", "mezzanine")
    sys.path.insert(0, os.path.join(*parts))
    sys.path.insert(0, os.path.join(*parts + ("project_template", )))
    settings_module = "mezzanine.project_template.settings"
    os.environ["DJANGO_SETTINGS_MODULE"] = settings_module

# When a full build is run (eg from the root of the repo), we
# run all the Mezzanine utils for dynamically generated docs.
if sys.argv[-2:] == ["docs", "docs/build"]:
    from mezzanine.utils import docs
    docs.build_settings_docs(docs_path)
    docs.build_deploy_docs(docs_path)
    docs.build_changelog(docs_path)
    docs.build_modelgraph(docs_path)
    docs.build_requirements(docs_path)

# 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.append(os.path.abspath('.'))

# -- General configuration -----------------------------------------------------

# Add any Sphinx extension module names here, as strings. They can be extensions
# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
extensions = ["sphinx.ext.autodoc"]

# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
コード例 #2
0
ファイル: conf.py プロジェクト: AkademieOlympia/cartridge
# serve to show the default.

import sys
import os

docs_path = os.path.abspath(os.path.dirname(__file__))
sys.path.insert(0, os.path.join(docs_path, ".."))
sys.path.insert(0, os.path.join(docs_path, "..", "..", "mezzanine"))
os.environ["DJANGO_SETTINGS_MODULE"] = "cartridge.project_template.settings"

import cartridge
from mezzanine.utils import docs

docs.build_settings_docs(docs_path, prefix="SHOP_")
docs.build_changelog(docs_path, package_name="cartridge")
docs.build_modelgraph(docs_path, package_name="cartridge")

try:
    from cartridge.shop.models import Order
    from cartridge.shop.forms import OrderForm
    fields = {
        "form": OrderForm(None, None).fields.keys(),
        "model": [f.name for f in Order._meta.fields],
    }
    for name, names in fields.items():
        file_name = "order_%s_fields.rst" % name
        with open(os.path.join(docs_path, file_name), "w") as f:
            f.write("  * ``" + "``\n  * ``".join(names) + "``")
except Exception, e:
    print "Error generating docs for fields: %s" % e
コード例 #3
0
ファイル: conf.py プロジェクト: Anlim/mezzanine
    os.environ["DJANGO_SETTINGS_MODULE"] = "docs_settings"
    # Django 1.7's setup is required before touching translated strings.
    import django
    try:
        django.setup()
    except AttributeError:  # < 1.7
        pass

# When a full build is run (eg from the root of the repo), we
# run all the Mezzanine utils for dynamically generated docs.
if sys.argv[-2:] == ["docs", "docs/build"]:
    from mezzanine.utils import docs
    docs.build_settings_docs(docs_path)
    docs.build_deploy_docs(docs_path)
    docs.build_changelog(docs_path)
    docs.build_modelgraph(docs_path)
    docs.build_requirements(docs_path)

# 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.append(os.path.abspath('.'))

# -- General configuration -----------------------------------------------------

# Add any Sphinx extension module names here, as strings. They can be extensions
# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
extensions = ["sphinx.ext.autodoc", "sphinx.ext.viewcode"]

# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
コード例 #4
0
# serve to show the default.

import sys
import os

docs_path = os.path.abspath(os.path.dirname(__file__))
sys.path.insert(0, os.path.join(docs_path, ".."))
sys.path.insert(0, os.path.join(docs_path, "..", "..", "mezzanine"))
os.environ["DJANGO_SETTINGS_MODULE"] = "cartridge.project_template.settings"

import cartridge
from mezzanine.utils import docs

docs.build_settings_docs(docs_path, prefix="SHOP_")
docs.build_changelog(docs_path, package_name="cartridge")
docs.build_modelgraph(docs_path, package_name="cartridge")

try:
    from cartridge.shop.models import Order
    from cartridge.shop.forms import OrderForm
    fields = {
        "form": OrderForm(None, None).fields.keys(),
        "model": [f.name for f in Order._meta.fields],
    }
    for name, names in fields.items():
        file_name = "order_%s_fields.rst" % name
        with open(os.path.join(docs_path, file_name), "w") as f:
            f.write("  * ``" + "``\n  * ``".join(names) + "``")
except Exception, e:
    print "Error generating docs for fields: %s" % e