From d84d439e6e6546f740a3a87654db3e87368cd42a Mon Sep 17 00:00:00 2001 From: root Date: Mon, 19 Jul 2021 04:05:20 +0000 Subject: [PATCH] setup on server --- config/__init__.py | 0 config/__pycache__/__init__.cpython-38.pyc | Bin 0 -> 111 bytes config/__pycache__/default.cpython-38.pyc | Bin 0 -> 128 bytes config/default.py | 1 + onyx-live.ini | 13 +++++++++++++ serve.py | 2 ++ static/src/index.js | 4 ++-- templates/index.html | 8 ++++---- wsgi.py | 5 +++++ 9 files changed, 27 insertions(+), 6 deletions(-) create mode 100644 config/__init__.py create mode 100644 config/__pycache__/__init__.cpython-38.pyc create mode 100644 config/__pycache__/default.cpython-38.pyc create mode 100644 config/default.py create mode 100644 onyx-live.ini create mode 100644 wsgi.py 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 0000000000000000000000000000000000000000..fcc7cbdb2f5f719fa2bd587d86094e5b705283e0 GIT binary patch literal 111 zcmWIL<>g`k0-eua5&ryk0@&Ee@O9{FKt1R6CIB&p^xo0H#S4<^TWy literal 0 HcmV?d00001 diff --git a/config/__pycache__/default.cpython-38.pyc b/config/__pycache__/default.cpython-38.pyc new file mode 100644 index 0000000000000000000000000000000000000000..536f02b53fe7dc538594be0b217f7ca5c9b5b278 GIT binary patch literal 128 zcmWIL<>g`kg4$1C5(I(tV-N=!FakLaKwQiLBvKfn7*ZI688n%ySoQPsDl7an8KXE{ z{agb4J^eyfG8BPSgNa|ldiu%vd1;yH`YEYtiKRIudIgoYIBatBQ%ZAE?Lg{212F>t DlJ^?5 literal 0 HcmV?d00001 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() + -- 2.25.1