Skip to content

Commit 2f4325e

Browse files
authored
Merge pull request #510 from globocom/FLSTD-3281
fix docs conf.py
2 parents bb711e7 + 3ea3e03 commit 2f4325e

1 file changed

Lines changed: 17 additions & 4 deletions

File tree

docs/conf.py

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,13 @@
4040
# documentation root, use os.path.abspath to make it absolute, like shown here.
4141
sys.path.insert(1, dirname(dirname(abspath(__file__))))
4242

43-
os.environ['DJANGO_SETTINGS_MODULE'] = 'networkapi.settings'
44-
import networkapi.settings
43+
# Skip Django configuration on ReadTheDocs to avoid SECRET_KEY errors
44+
if not os.environ.get('READTHEDOCS'):
45+
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'networkapi.settings')
46+
try:
47+
import networkapi.settings
48+
except Exception:
49+
pass
4550

4651
# -- General configuration ------------------------------------------------
4752

@@ -77,9 +82,17 @@
7782
# built documents.
7883
#
7984
# The short X.Y version.
80-
version = networkapi.VERSION
85+
try:
86+
import networkapi
87+
version = networkapi.VERSION
88+
except (ImportError, AttributeError):
89+
version = '3.14.11'
8190
# The full version, including alpha/beta/rc tags.
82-
release = networkapi.VERSION
91+
try:
92+
import networkapi
93+
release = networkapi.VERSION
94+
except (ImportError, AttributeError):
95+
release = '3.14.11'
8396

8497
# The language for content autogenerated by Sphinx. Refer to documentation
8598
# for a list of supported languages.

0 commit comments

Comments
 (0)