wger: added redis, cache/compressed/combined, nginx serves static
This commit is contained in:
parent
97f9561631
commit
e7af4737c1
2 changed files with 53 additions and 6 deletions
|
@ -3,6 +3,7 @@
|
|||
python3,
|
||||
fetchFromGitHub,
|
||||
callPackage,
|
||||
writeText,
|
||||
}:
|
||||
|
||||
let
|
||||
|
@ -79,8 +80,37 @@ in python3.pkgs.buildPythonApplication rec {
|
|||
cp manage.py wger/manage.py
|
||||
'';
|
||||
|
||||
# fixup compressed files
|
||||
postBuild = let
|
||||
staticSettings = writeText "static_settings.py" ''
|
||||
DEBUG = False
|
||||
STATIC_ROOT = os.environ["static"]
|
||||
COMPRESS_OFFLINE = True
|
||||
# So we don't need postgres dependencies
|
||||
DATABASES = {}
|
||||
'';
|
||||
in ''
|
||||
# copy over static yarn things
|
||||
# cp -a ${frontend}/static/yarn $out/${python3.sitePackages}/wger/core/static
|
||||
cp -a ${frontend}/static/yarn wger/core/static
|
||||
|
||||
python3 -m wger.tasks create-settings -s $PWD/tmp_settings.py
|
||||
cat ${staticSettings} >> $PWD/tmp_settings.py
|
||||
mkdir tmpstatic
|
||||
pushd tmpstatic
|
||||
|
||||
static=. WGER_SETTINGS=../tmp_settings.py python3 ../manage.py collectstatic --no-input
|
||||
static=. WGER_SETTINGS=../tmp_settings.py python3 ../manage.py compress --force
|
||||
|
||||
popd
|
||||
'';
|
||||
|
||||
postInstall = ''
|
||||
cp -a ${frontend}/static/yarn $out/${python3.sitePackages}/wger/core/static
|
||||
rm -rf $out/${python3.sitePackages}/wger/core/static
|
||||
cp -a tmpstatic $out/${python3.sitePackages}/wger/core/static
|
||||
|
||||
mkdir $out/share
|
||||
cp -a $out/${python3.sitePackages}/wger/core/static $out/share
|
||||
'';
|
||||
|
||||
pythonImportsCheck = [
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue