From 1569066ab741213e2e8eba3c096c87164ffaf4c8 Mon Sep 17 00:00:00 2001 From: Sebastian Schrader Date: Mon, 5 Feb 2018 07:19:59 +0100 Subject: [PATCH] Serve static assets by nginx Resolves #56 --- configure.mk | 3 ++- templates/nginx/sites-available/default.j2 | 4 ++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/configure.mk b/configure.mk index 81bbe16c..1e69eb16 100755 --- a/configure.mk +++ b/configure.mk @@ -103,7 +103,8 @@ $(call add_substitution, pkgdatadir, $(datadir)/$(PACKAGE_NAME)) $(call add_substitution, pkglogdir, $(logdir)/$(PACKAGE_NAME)) # Additional directories -$(call add_substitution, assetdir, $(pkgdatadir)/assests) +$(call add_substitution, pythonsitedir, $(shell python3 -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())")) +$(call add_substitution, assetdir, $(pythonsitedir)/hades/portal/assets) $(call add_substitution, systemdenvfile, /etc/default/hades) $(call add_substitution, templatedir, $(pkgdatadir)/templates) $(call add_substitution, venvdir, $(NULL)) diff --git a/templates/nginx/sites-available/default.j2 b/templates/nginx/sites-available/default.j2 index b65bc56f..48008790 100644 --- a/templates/nginx/sites-available/default.j2 +++ b/templates/nginx/sites-available/default.j2 @@ -39,4 +39,8 @@ server { include uwsgi_params; uwsgi_pass unix:{{ constants.PORTAL_UWSGI_SOCKET }}; } + + location /assets { + alias {{ constants.assetdir }}; + } }