conf.py 6.29 KB
Newer Older
Mark Hoeber committed
1
# -*- coding: utf-8 -*-
2
# pylint: disable=invalid-name
3
# pylint: disable=redefined-builtin
4
# pylint: disable=protected-access
5
# pylint: disable=unused-argument
Mark Hoeber committed
6

7
import os
8
from path import Path as path
9
import sys
10
import mock
11

12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
MOCK_MODULES = [
    'lxml',
    'requests',
    'xblock',
    'xblock.fields',
    'xblock.fragment',
    'webob',
    'webob.multidict',
    'xblock.core',
    'xblock.runtime',
    'sortedcontainers',
    'contracts',
    'xblock.plugin',
    'opaque_keys.edx.asides',
    'dogstats_wrapper',
    'fs',
    'fs.errors',
    'edxmako',
    'edxmako.shortcuts',
    'crum',
    'opaque_keys.edx.locator',
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51
    'ipware',
    'ipware.ip',
    'pygeoip',
    'ipaddr',
    'django_countries',
    'django_countries.fields',
    'opaque_keys',
    'opaque_keys.edx',
    'opaque_keys.edx.keys',
    'opaque_keys.edx.locations',
    'courseware',
    'courseware.access',
    'courseware.model_data',
    'courseware.module_render',
    'courseware.views',
    'util.request',
    'eventtracking',
    'xmodule',
    'xmodule.exceptions',
52
    'xmodule.modulestore',
53 54
    'xmodule.modulestore.exceptions',
    'xmodule.modulestore.django',
55
    'xmodule.fields',
56 57 58 59 60 61 62 63
    'courseware.models',
    'milestones',
    'milestones.api',
    'milestones.models',
    'milestones.exceptions',
    'ratelimitbackend',
    'analytics',
    'courseware.courses',
64 65
    'django.contrib.staticfiles',
    'django.contrib.staticfiles.storage',
66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90
    'xmodule.contentstore',
    'xmodule.contentstore.content',
    'xblock.exceptions',
    'xmodule.seq_module',
    'xmodule.vertical_module',
    'xmodule.x_module',
    'nltk',
    'ratelimitbackend',
    'ratelimitbackend.exceptions',
    'social',
    'social.apps',
    'social.apps.django_app',
    'social.backends',
    'mako',
    'mako.exceptions',
    'boto',
    'boto.exception',
    'PIL',
    'reportlab',
    'reportlab.lib',
    'pdfgen',
    'pdfgen.canvas',
    'reportlab.pdfgen',
    'reportlab.pdfgen.canvas',
    'reportlab.lib.pagesizes',
91
    'reportlab.lib.units',
92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132
    'reportlab.lib.styles',
    'reportlab.platypus',
    'reportlab.platypus.tables',
    'boto.s3',
    'boto.s3.connection',
    'boto.s3.key',
    'Crypto',
    'Crypto.Cipher',
    'Crypto.PublicKey',
    'openid',
    'openid.store',
    'openid.store.interface',
    'external_auth.views',
    'mail_utils',
    'ratelimitbackend.backends',
    'social.apps.django_app.default',
    'social.exceptions',
    'social.pipeline',
    'xmodule.error_module',
    'accounts.api',
    'modulestore.mongo.base',
    'xmodule.modulestore.mongo',
    'xmodule.modulestore.mongo.base',
    'edxval',
    'edxval.api',
    'certificates',
    'certificates.models',
    'certificates.models.GeneratedCertificate',
    'shoppingcart',
    'shopppingcart.models',
    'shopppingcart.api',
    'api',
    'student',
    'student.views',
    'student.forms',
    'student.models',
    'celery',
    'celery.task',
    'student.roles',
    'embargo.models',
    'xmodule.vertical_block',
133 134 135
    'xmodule.course_module',
    'user_api.accounts.api',
    'user_api.accounts.serializers',
136 137 138
    'edx_rest_api_client',
    'edx_rest_api_client.client',
    'edx_rest_api_client.exceptions',
139 140 141
    'student.auth',
    'ccx_keys',
    'ccx_keys.locator',
142
    'user_api.preferences.api',
143 144 145
    'rest_framework_oauth.authentication',
    'certificates.api',
    'courseware.date_summary',
146 147 148 149 150 151 152 153
    'rest_framework_jwt',
    'rest_framework_jwt.authentication',
    'microsite_configuration',
    'xmodule.assetstore',
    'xmodule.assetstore.assetmgr',
    'xmodule.assetstore.assetmgr.AssetManager',
    'xmodule.contentstore.django',
    'piexif',
154
]
155

stv committed
156
for mod_name in MOCK_MODULES:
157
    sys.modules[mod_name] = mock.Mock()
Mark Hoeber committed
158

159 160 161 162 163 164 165 166 167 168 169 170 171
if "DJANGO_SETTINGS_MODULE" not in os.environ:
    docs_path = os.getcwd()
    mezzanine_path_parts = (docs_path, "..")
    sys.path.insert(0, docs_path)
    sys.path.insert(0, os.path.realpath(os.path.join(*mezzanine_path_parts)))
    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

Mark Hoeber committed
172 173 174
on_rtd = os.environ.get('READTHEDOCS', None) == 'True'

sys.path.append('../../../../')
175 176
os.environ['DJANGO_SETTINGS_MODULE'] = 'lms.envs.dev'
#os.environ.setdefault("DJANGO_SETTINGS_MODULE", "lms.envs.dev")
Mark Hoeber committed
177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200

from docs.shared.conf import *


# Add any paths that contain templates here, relative to this directory.
#templates_path.append('source/_templates')


# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
#html_static_path.append('source/_static')

if not on_rtd:  # only import and set the theme if we're building docs locally
    import sphinx_rtd_theme
    html_theme = 'sphinx_rtd_theme'
    html_theme_path = [sphinx_rtd_theme.get_html_theme_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.
root = path('../../../..').abspath()
sys.path.insert(0, root)
201
sys.path.append(root / "common/lib/xmodule")
202
sys.path.append(root / "common/djangoapps")
203
sys.path.append(root / "lms/djangoapps")
204
sys.path.append(root / "lms/envs")
205
sys.path.append(root / "openedx/core/djangoapps")
Mark Hoeber committed
206

207 208 209 210 211 212 213 214
sys.path.insert(
    0,
    os.path.abspath(
        os.path.normpath(
            os.path.dirname(__file__) + '/../../../'
        )
    )
)
Mark Hoeber committed
215 216 217 218 219 220
sys.path.append('.')

#  django configuration  - careful here
if on_rtd:
    os.environ['DJANGO_SETTINGS_MODULE'] = 'lms'
else:
221
    os.environ['DJANGO_SETTINGS_MODULE'] = 'lms'
Mark Hoeber committed
222 223 224 225 226 227 228 229 230 231 232


# -- 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.doctest', 'sphinx.ext.intersphinx',
    'sphinx.ext.todo', 'sphinx.ext.coverage', 'sphinx.ext.pngmath',
    'sphinx.ext.mathjax', 'sphinx.ext.viewcode', 'sphinxcontrib.napoleon']

233
project = u'Open edX Platform APIs'
234
copyright = u'2015, edX'
Mark Hoeber committed
235

236
exclude_patterns = ['build', 'links.rst']