summaryrefslogtreecommitdiffstats
path: root/back
diff options
context:
space:
mode:
authorsyn <isaqtm@gmail.com>2021-03-08 21:23:24 +0300
committersyn <isaqtm@gmail.com>2021-03-08 21:23:24 +0300
commit2f38658f5d86a199a1066341883aa69bd6e49828 (patch)
tree6493c73076c2fdef371d40d285197499505db604 /back
parent82b3f4c5e419bd6fdaa0dae14c92586b51aee8d7 (diff)
downloadupnet-2f38658f5d86a199a1066341883aa69bd6e49828.tar.gz
Improve build process
Diffstat (limited to 'back')
-rw-r--r--back/app.py15
-rw-r--r--back/config.py2
2 files changed, 9 insertions, 8 deletions
diff --git a/back/app.py b/back/app.py
index 7d082d4..0d7bbee 100644
--- a/back/app.py
+++ b/back/app.py
@@ -1,7 +1,7 @@
from __future__ import annotations
from sanic import Sanic
from sanic.response import json as response_json, file
-from config import APP_DIR
+from config import APP_DIR, debug as is_debug
from aioredis import create_redis_pool
from dataclasses import dataclass, fields, asdict
import json
@@ -10,12 +10,11 @@ from math import floor
app = Sanic(__name__)
-app.static("/", APP_DIR + "/../front/index.html")
-app.static("/js/out.js", APP_DIR + "/../front/out.js")
-app.static("/css/style.css", APP_DIR + "/../front/style.css")
-app.static("/css/twemoji-awesome.css", APP_DIR + "/../front/twemoji-awesome.css")
-app.static("/AnkaCoder/", APP_DIR + "/../front/AnkaCoder")
-app.static("/AnkaCoderCondensed/", APP_DIR + "/../front/AnkaCoderCondensed")
+if is_debug:
+ # in release environment, these will be served by nginx
+ # but in debug, we serve this shit directly.
+ # app.static("/", APP_DIR + "/../front/index.html")
+ app.static("/", APP_DIR + "/../front/dist/")
def now_ms() -> int:
@@ -103,4 +102,4 @@ async def get_todos(req):
return response_json({ "todos": todos })
if __name__ == "__main__":
- app.go_fast(host="0.0.0.0", port=8000, debug=True)
+ app.go_fast(host="0.0.0.0", port=8000, debug=is_debug)
diff --git a/back/config.py b/back/config.py
index a3185ee..9c5b6fd 100644
--- a/back/config.py
+++ b/back/config.py
@@ -10,3 +10,5 @@ if modpath.endswith('.pyc') and os.path.exists(modpath[:-1]):
# Sort out symlinks
APP_DIR = os.path.realpath(os.path.dirname(modpath))
REDIS_HOST = 'localhost'
+
+debug = True