only serve frontend build if built

This commit is contained in:
slice 2018-07-18 14:58:11 -07:00
parent d842ebfccb
commit ad601769c4
No known key found for this signature in database
GPG Key ID: 1508C19D7436A26D
1 changed files with 4 additions and 2 deletions

6
run.py
View File

@ -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')