diff --git a/docs/conf.py b/docs/conf.py index c229241d..61051b15 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -40,8 +40,13 @@ # documentation root, use os.path.abspath to make it absolute, like shown here. sys.path.insert(1, dirname(dirname(abspath(__file__)))) -os.environ['DJANGO_SETTINGS_MODULE'] = 'networkapi.settings' -import networkapi.settings +# Skip Django configuration on ReadTheDocs to avoid SECRET_KEY errors +if not os.environ.get('READTHEDOCS'): + os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'networkapi.settings') + try: + import networkapi.settings + except Exception: + pass # -- General configuration ------------------------------------------------ @@ -77,9 +82,17 @@ # built documents. # # The short X.Y version. -version = networkapi.VERSION +try: + import networkapi + version = networkapi.VERSION +except (ImportError, AttributeError): + version = '3.14.11' # The full version, including alpha/beta/rc tags. -release = networkapi.VERSION +try: + import networkapi + release = networkapi.VERSION +except (ImportError, AttributeError): + release = '3.14.11' # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages.