Skip to content

Commit

Permalink
Try fix nginx X-accel-redirect
Browse files Browse the repository at this point in the history
  • Loading branch information
neoformit committed Jan 16, 2025
1 parent b51dab8 commit ed17518
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion app/app/settings/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
MEDIA_ROOT = BASE_DIR / 'app/media'
LOG_ROOT = ensure_dir(BASE_DIR / 'app/logs')
TEMP_DIR = ensure_dir(os.getenv('TMP_DIR', '/tmp/labs_engine/'))
INTERNAL_ROOT = TEMP_DIR
INTERNAL_ROOT = TEMP_DIR / 'internal'
DEFAULT_EXPORTED_LAB_CONTENT_ROOT = (
f'http://{HOSTNAME}/static/labs/content/docs/base.yml')

Expand Down
6 changes: 3 additions & 3 deletions app/labs/bootstrap.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ def random_string(length):

def lab(form_data):
"""Render a new lab from form data."""
clean_dir(settings.TEMP_DIR)
output_dir = settings.TEMP_DIR / random_string(6)
clean_dir(settings.INTERNAL_ROOT)
output_dir = settings.INTERNAL_ROOT / random_string(6)
form_data['logo_filename'] = create_logo(form_data, output_dir)
render_templates(form_data, output_dir)
render_server_yml(form_data, output_dir)
Expand All @@ -46,7 +46,7 @@ def lab(form_data):
with zipfile.ZipFile(zipfile_path, 'w') as zf:
for path in output_dir.rglob('*'):
zf.write(path, root_dir / path.relative_to(output_dir))
return Path(str(zipfile_path).replace(str(settings.TEMP_DIR), ''))
return Path(str(zipfile_path).replace(str(settings.INTERNAL_ROOT), ''))


def render_templates(data, output_dir):
Expand Down

0 comments on commit ed17518

Please sign in to comment.