Commit 21ce085c authored by Pietro Albini's avatar Pietro Albini

Always put /+assets in the cache

parent f1b74f6a
......@@ -41,6 +41,23 @@ def run(cache, gunicorn_config, port, public, workers, debug):
app = uitwww.create_app(cache)
app.wsgi_app = utils.ReverseProxied(app.wsgi_app)
src_directory = os.path.dirname(os.path.abspath(__file__))
# Link static assets to the cache directory, if it's enabled
static_dirs = {"static": "+assets"}
if cache is not None:
if not os.path.exists(cache):
os.makedirs(cache)
for src, dest in static_dirs.items():
dest = os.path.join(cache, dest)
# The destinationa already exists
if os.path.exists(dest):
continue
os.symlink(os.path.join(src_directory, src), dest)
host = "127.0.0.1"
if public:
host = "0.0.0.0"
......@@ -48,7 +65,7 @@ def run(cache, gunicorn_config, port, public, workers, debug):
# In debug mode, run the flask builtin webserver
if debug:
extra_files = [
os.path.join(os.path.dirname(__file__), "navbar.json"),
os.path.join(src_directory, "navbar.json"),
]
app.run(debug=True, port=port, host=host, extra_files=extra_files)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment