diff --git a/vreapis/containerizer/views.py b/vreapis/containerizer/views.py index 4d74259..6432af6 100644 --- a/vreapis/containerizer/views.py +++ b/vreapis/containerizer/views.py @@ -30,6 +30,7 @@ import jsonschema from slugify import slugify from github import Github, UnknownObjectException +from django.conf import settings from catalog.serializers import CellSerializer from containerizer.RContainerizer import RContainerizer @@ -94,8 +95,7 @@ def post(self, request: Request): # common.logger.debug('ExtractorHandler. payload: ' + json.dumps(payload, indent=4)) if 'rmarkdown' in payload: # Directly setting `NotebookNode.metadata['jupytext'] = {'split_at_heading': True, }` has no use. I don't know why. So we don't use lib jupytext here. - venv_activator = '/opt/venv/bin/activate' - command_jupytext = f'source {venv_activator}; jupytext --from Rmd --to ipynb --opt split_at_heading=true -o -' + command_jupytext = f'source {settings.VENV_ACTIVATOR}; jupytext --from Rmd --to ipynb --opt split_at_heading=true -o -' process_jupytext = subprocess.Popen(command_jupytext, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True, executable='/bin/bash') stdout, stderr = process_jupytext.communicate(input=payload['rmarkdown'].encode()) process_jupytext.stdin.close() diff --git a/vreapis/vreapis/settings/base.py b/vreapis/vreapis/settings/base.py index 026df70..7299ea7 100644 --- a/vreapis/vreapis/settings/base.py +++ b/vreapis/vreapis/settings/base.py @@ -188,7 +188,7 @@ STATIC_URL = f'{BASE_PATH}/static/' STATIC_ROOT = BASE_DIR / "staticfiles" -# CUSTOM VARS +# CUSTOM VARS # todo. delete default values API_ENDPOINT: str = os.getenv('API_ENDPOINT', "https://naavre-dev.minikube.test/vre-api-test") @@ -199,3 +199,5 @@ KEYCLOAK_CLIENT_ID: str = os.getenv('KEYCLOAK_CLIENT_ID', 'myclient') NAAVRE_API_TOKEN: str = os.getenv('NAAVRE_API_TOKEN') + +VENV_ACTIVATOR: str = os.getenv('VENV_ACTIVATOR', '/opt/venv/bin/activate')