From ad601769c429ad4aee856adef6ed3e46649fd4f5 Mon Sep 17 00:00:00 2001 From: slice Date: Wed, 18 Jul 2018 14:58:11 -0700 Subject: [PATCH] only serve frontend build if built --- run.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/run.py b/run.py index e0d938d..975765e 100644 --- a/run.py +++ b/run.py @@ -1,5 +1,6 @@ import logging import sqlite3 +from os.path import isdir import aiohttp from sanic import Sanic, response @@ -60,7 +61,8 @@ async def _handle_exc(request, exception): if __name__ == '__main__': - app.static('/', './priv/frontend/build') - app.static('/', './priv/frontend/build/index.html') + if isdir('./priv/frontend/build'): + app.static('/', './priv/frontend/build') + app.static('/', './priv/frontend/build/index.html') app.run(port=config.PORT, host='0.0.0.0')