Fix issue with Heroku + Django Compressor

This commit is contained in:
Bruno Alla 2020-05-01 18:36:01 +01:00 committed by Bruno Alla
parent 6f76309759
commit 68116dcdea
4 changed files with 29 additions and 2 deletions

1
.gitignore vendored
View File

@ -211,7 +211,6 @@ tags
### VirtualEnv template
# Virtualenv
# http://iamzed.com/2009/05/07/a-primer-on-virtualenv/
[Bb]in
[Ii]nclude
[Ll]ib
[Ll]ib64

View File

@ -75,6 +75,11 @@ def remove_heroku_files():
# don't remove the file if we are using travisci but not using heroku
continue
os.remove(file_name)
remove_heroku_build_hooks()
def remove_heroku_build_hooks():
shutil.rmtree("bin")
def remove_gulp_files():
@ -346,6 +351,8 @@ def main():
if "{{ cookiecutter.use_heroku }}".lower() == "n":
remove_heroku_files()
elif "{{ cookiecutter.use_compressor }}".lower() == "n":
remove_heroku_build_hooks()
if (
"{{ cookiecutter.use_docker }}".lower() == "n"

View File

@ -325,7 +325,6 @@ tags
### VirtualEnv template
# Virtualenv
[Bb]in
[Ii]nclude
[Ll]ib
[Ll]ib64

View File

@ -0,0 +1,22 @@
#!/usr/bin/env bash
compress_enabled() {
python << END
import sys
from environ import Env
env = Env(COMPRESS_ENABLED=(bool, True))
if env('COMPRESS_ENABLED'):
sys.exit(0)
else:
sys.exit(1)
END
}
if compress_enabled
then
python manage.py compress
fi
python manage.py collectstatic --noinput