diff options
| author | Leon Overweel <l.overweel@gmail.com> | 2017-01-25 16:26:05 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2017-01-25 16:26:05 +0100 |
| commit | 1b942d9e9d5b2c08d09fb8f294437ea99a889962 (patch) | |
| tree | ecce75c171445755e20e2930682b1c78bbd9e15e /main.py | |
| parent | 8a8279ec685311ceffd2aadb1dc7c76e8637f043 (diff) | |
| parent | 532ecf39611113ac59b084935f68016bd353e73f (diff) | |
Merge pull request #1 from sacheendra/master
New static file locations. Config file location from command line. Port binding.
Diffstat (limited to 'main.py')
| -rw-r--r-- | main.py | 14 |
1 files changed, 9 insertions, 5 deletions
@@ -12,11 +12,15 @@ from oauth2client import client, crypt from opendc.models.user import User from opendc.util import exceptions, rest +if len(sys.argv) < 2: + print "config file path not given as argument" + sys.exit(1) + # Get keys from config file -with open('/var/www/opendc.ewi.tudelft.nl/web-server/config/keys.json') as file: +with open(sys.argv[1]) as file: KEYS = json.load(file) -STATIC_ROOT = os.path.join(KEYS['ROOT_DIR'], 'static', 'build') +STATIC_ROOT = os.path.join(KEYS['ROOT_DIR'], 'opendc-frontend', 'build') FLASK_CORE_APP = Flask(__name__, static_url_path='') FLASK_CORE_APP.config['SECREY_KEY'] = KEYS['FLASK_SECRET'] @@ -55,7 +59,7 @@ def serve_projects(): def serve_web_server_test(): """Serve the web server test.""" - return send_from_directory(os.path.join(KEYS['ROOT_DIR'], 'web-server', 'static'), 'index.html') + return send_from_directory(os.path.join(KEYS['ROOT_DIR'], 'opendc-web-server', 'static'), 'index.html') @FLASK_CORE_APP.route('/<path:folder>/<path:filepath>') def serve_static(folder, filepath): @@ -64,7 +68,7 @@ def serve_static(folder, filepath): if not folder in ['bower_components', 'img', 'scripts', 'styles']: abort(404) - return send_from_directory(os.path.join(KEYS['ROOT_DIR'], 'static', 'build', folder), filepath) + return send_from_directory(os.path.join(STATIC_ROOT, folder), filepath) @FLASK_CORE_APP.route('/tokensignin', methods=['POST']) def sign_in(): @@ -144,5 +148,5 @@ def receive_message(message): ) -SOCKET_IO_CORE.run(FLASK_CORE_APP, port=8081) +SOCKET_IO_CORE.run(FLASK_CORE_APP, host='0.0.0.0', port=8081) |
