Skip to content
Snippets Groups Projects
Verified Commit 00e08428 authored by Owen Graham's avatar Owen Graham
Browse files

Move venv-activating code to CGI script

parent e67ef7b3
Branches
No related tags found
No related merge requests found
......@@ -6,10 +6,15 @@ import os.path
import sys
from wsgiref.handlers import CGIHandler
if __name__ == '__main__':
# Move to project directory.
os.chdir('..')
sys.path[0] = os.path.abspath('.')
# Move to project directory.
os.chdir('..')
sys.path[0] = os.path.abspath('.')
from visualizer import app
CGIHandler().run(app)
# Activate the virtual environment to give visualizer.py access to
# non-standard packages.
activator = 'venv/bin/activate_this.py'
exec(open(activator).read(), {'__file__': activator})
# Run the app as CGI.
from visualizer import app
CGIHandler().run(app)
......@@ -5,10 +5,6 @@ import math
from types import SimpleNamespace
from urllib.request import urlopen
# Activate the virtual env to get access to non-standard packages.
activator = 'venv/bin/activate_this.py'
exec(open(activator).read(), {'__file__': activator})
import asccol
from dataclasses import make_dataclass
from flask import abort, Flask, g, jsonify, render_template, request, Response
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment