mirror of
https://github.com/inventree/inventree-docs.git
synced 2025-04-27 21:26:43 +00:00
Prevent infinite loop when serving development version of docs
This commit is contained in:
parent
5ec98a62dd
commit
3c65e99427
18
main.py
18
main.py
@ -9,15 +9,17 @@ def define_env(env):
|
||||
# Ensure that the config template is always up to date
|
||||
CFG_URL = "https://raw.githubusercontent.com/inventree/InvenTree/master/InvenTree/config_template.yaml"
|
||||
|
||||
response = request.urlopen(CFG_URL)
|
||||
print(f"Reading config template from GitHub: Response {response.status}")
|
||||
|
||||
if response.status == 200:
|
||||
data = response.read()
|
||||
# Only perform this step if we are building on RTD server
|
||||
if os.environ.get('READTHEDOCS', False):
|
||||
response = request.urlopen(CFG_URL)
|
||||
print(f"Reading config template from GitHub: Response {response.status}")
|
||||
|
||||
if response.status == 200:
|
||||
data = response.read()
|
||||
|
||||
if len(data) > 0:
|
||||
with open("_includes/config.yaml", "w") as f:
|
||||
f.write(str(data.decode()))
|
||||
if len(data) > 0:
|
||||
with open("_includes/config.yaml", "w") as f:
|
||||
f.write(str(data.decode()))
|
||||
|
||||
@env.macro
|
||||
def listimages(subdir):
|
||||
|
Loading…
x
Reference in New Issue
Block a user