From: root Date: Mon, 19 Jul 2021 04:05:20 +0000 (+0000) Subject: setup on server X-Git-Url: https://git.brendanfh.com/?a=commitdiff_plain;h=d84d439e6e6546f740a3a87654db3e87368cd42a;p=onyx-live.git setup on server --- diff --git a/config/__init__.py b/config/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/config/__pycache__/__init__.cpython-38.pyc b/config/__pycache__/__init__.cpython-38.pyc new file mode 100644 index 0000000..fcc7cbd Binary files /dev/null and b/config/__pycache__/__init__.cpython-38.pyc differ diff --git a/config/__pycache__/default.cpython-38.pyc b/config/__pycache__/default.cpython-38.pyc new file mode 100644 index 0000000..536f02b Binary files /dev/null and b/config/__pycache__/default.cpython-38.pyc differ diff --git a/config/default.py b/config/default.py new file mode 100644 index 0000000..48ef9ba --- /dev/null +++ b/config/default.py @@ -0,0 +1 @@ +ENDPOINT="/onyx" diff --git a/onyx-live.ini b/onyx-live.ini new file mode 100644 index 0000000..432f6fe --- /dev/null +++ b/onyx-live.ini @@ -0,0 +1,13 @@ +[uwsgi] +module = wsgi:app + +master = true +processes = 2 + +socket = onyx-live.sock +chmod-socket = 660 +vacuum = true + +plugins=python3 + +die-on-term = true diff --git a/serve.py b/serve.py index 3cbb365..decca69 100644 --- a/serve.py +++ b/serve.py @@ -6,6 +6,8 @@ app = Flask( instance_relative_config=True, ) +app.config.from_object("config.default") + @app.route("/") def get_homepage(): return flask.render_template("index.html") diff --git a/static/src/index.js b/static/src/index.js index 666d702..ddf652c 100644 --- a/static/src/index.js +++ b/static/src/index.js @@ -34,7 +34,7 @@ async function run_wasm(wasm_bytes) { } update_running_msg(); - wasm_worker = new Worker('static/src/worker.js'); + wasm_worker = new Worker(window.ROOT_ENDPOINT + '/static/src/worker.js'); wasm_worker.onmessage = (e) => { switch (e.data.type) { @@ -59,7 +59,7 @@ async function submit_code() { clear_output(); let code = ace.edit('code-editor').getValue(); - let response = await fetch("/compile", { + let response = await fetch(window.ROOT_ENDPOINT + "/compile", { method: 'POST', cache: 'no-cache', headers: { diff --git a/templates/index.html b/templates/index.html index 5b21914..7a7715a 100644 --- a/templates/index.html +++ b/templates/index.html @@ -3,11 +3,11 @@ Onyx compiler - - - - + + + + diff --git a/wsgi.py b/wsgi.py new file mode 100644 index 0000000..52a9ba8 --- /dev/null +++ b/wsgi.py @@ -0,0 +1,5 @@ +from serve import app + +if __name__ == "__main__": + app.run() +