summaryrefslogtreecommitdiff
path: root/cli
diff options
context:
space:
mode:
authorlens <lens@neural.garden>2020-12-26 20:59:17 +0000
committerlens <lens@neural.garden>2020-12-26 20:59:17 +0000
commit7c15f34186622410e25ee85c01d832e48e012140 (patch)
treee0a8dbd5e7b6a3936e7b9a666c2622ecc7ff1a65 /cli
parent94234db6a771f687788d3decc6dd1ba01731f7af (diff)
parent85bfb949fea4e69dabc5b7544ce70d26d3d11393 (diff)
Merge branch 'master' of asdf.us:swimmer
Diffstat (limited to 'cli')
-rw-r--r--cli/app/server/web.py8
-rw-r--r--cli/app/settings/app_cfg.py5
-rw-r--r--cli/commands/site/export.py2
3 files changed, 4 insertions, 11 deletions
diff --git a/cli/app/server/web.py b/cli/app/server/web.py
index 0436cd4..1a3b064 100644
--- a/cli/app/server/web.py
+++ b/cli/app/server/web.py
@@ -12,7 +12,7 @@ handler.setFormatter(formatter)
logger.addHandler(handler)
logging.getLogger().addHandler(logging.StreamHandler())
-from flask import Flask, Blueprint, send_from_directory, request
+from flask import Flask, send_from_directory, request
from app.sql.common import db, connection_url
from app.settings import app_cfg
@@ -25,8 +25,7 @@ def create_app(script_info=None):
"""
functional pattern for creating the flask app
"""
- logging.debug("Starting Flask app...")
-
+ logging.debug("Starting Swimmer server...")
app = Flask(__name__, static_folder=app_cfg.DIR_STATIC, static_url_path='/static')
app.config['SQLALCHEMY_DATABASE_URI'] = connection_url
app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False
@@ -45,9 +44,6 @@ def create_app(script_info=None):
@app.errorhandler(404)
def page_not_found(e):
return app.send_static_file(index_html), 200
- # path = os.path.join(os.path.dirname(__file__), './static/index.html')
- # with open(path, "r") as f:
- # return f.read(), 200
@app.route('/', methods=['GET'])
def index():
diff --git a/cli/app/settings/app_cfg.py b/cli/app/settings/app_cfg.py
index 0d724c7..5fc4982 100644
--- a/cli/app/settings/app_cfg.py
+++ b/cli/app/settings/app_cfg.py
@@ -58,10 +58,7 @@ URL_MEDIA = join(URL_DATA, 'media')
URL_UPLOADS = join(URL_DATA, 'uploads')
URL_EXPORTS = join(URL_DATA, 'exports')
-if 'cli' in os.getcwd():
- DIR_STATIC = os.path.abspath('../static')
-else:
- DIR_STATIC = os.path.abspath('static')
+DIR_STATIC = join(DIR_APP, 'static')
HASH_TREE_DEPTH = 3 # for sha256 subdirs
HASH_BRANCH_SIZE = 3 # for sha256 subdirs
diff --git a/cli/commands/site/export.py b/cli/commands/site/export.py
index 5f4636a..0ba6a62 100644
--- a/cli/commands/site/export.py
+++ b/cli/commands/site/export.py
@@ -30,7 +30,7 @@ def cli(ctx, opt_graph_path, opt_output_dir):
return
# build everything here
- graph_dir = join(opt_output_dir, graph.path)
+ graph_dir = os.path.abspath(join(opt_output_dir, graph.path))
# load site index
index_html = load_text(join(app_cfg.DIR_STATIC, 'site.html'), split=False)