mirror of
https://github.com/cookiecutter/cookiecutter-django.git
synced 2025-02-09 16:10:49 +03:00
Merge pull request #2583 from pydanny/2581-heroku-compressor-error
Fix OfflineGenerationError with Heroku + Django Compressor
This commit is contained in:
commit
4a4dd056d1
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -211,7 +211,6 @@ tags
|
||||||
### VirtualEnv template
|
### VirtualEnv template
|
||||||
# Virtualenv
|
# Virtualenv
|
||||||
# http://iamzed.com/2009/05/07/a-primer-on-virtualenv/
|
# http://iamzed.com/2009/05/07/a-primer-on-virtualenv/
|
||||||
[Bb]in
|
|
||||||
[Ii]nclude
|
[Ii]nclude
|
||||||
[Ll]ib
|
[Ll]ib
|
||||||
[Ll]ib64
|
[Ll]ib64
|
||||||
|
|
|
@ -75,6 +75,11 @@ def remove_heroku_files():
|
||||||
# don't remove the file if we are using travisci but not using heroku
|
# don't remove the file if we are using travisci but not using heroku
|
||||||
continue
|
continue
|
||||||
os.remove(file_name)
|
os.remove(file_name)
|
||||||
|
remove_heroku_build_hooks()
|
||||||
|
|
||||||
|
|
||||||
|
def remove_heroku_build_hooks():
|
||||||
|
shutil.rmtree("bin")
|
||||||
|
|
||||||
|
|
||||||
def remove_gulp_files():
|
def remove_gulp_files():
|
||||||
|
@ -346,6 +351,8 @@ def main():
|
||||||
|
|
||||||
if "{{ cookiecutter.use_heroku }}".lower() == "n":
|
if "{{ cookiecutter.use_heroku }}".lower() == "n":
|
||||||
remove_heroku_files()
|
remove_heroku_files()
|
||||||
|
elif "{{ cookiecutter.use_compressor }}".lower() == "n":
|
||||||
|
remove_heroku_build_hooks()
|
||||||
|
|
||||||
if (
|
if (
|
||||||
"{{ cookiecutter.use_docker }}".lower() == "n"
|
"{{ cookiecutter.use_docker }}".lower() == "n"
|
||||||
|
|
1
{{cookiecutter.project_slug}}/.gitignore
vendored
1
{{cookiecutter.project_slug}}/.gitignore
vendored
|
@ -325,7 +325,6 @@ tags
|
||||||
|
|
||||||
### VirtualEnv template
|
### VirtualEnv template
|
||||||
# Virtualenv
|
# Virtualenv
|
||||||
[Bb]in
|
|
||||||
[Ii]nclude
|
[Ii]nclude
|
||||||
[Ll]ib
|
[Ll]ib
|
||||||
[Ll]ib64
|
[Ll]ib64
|
||||||
|
|
22
{{cookiecutter.project_slug}}/bin/post_compile
Normal file
22
{{cookiecutter.project_slug}}/bin/post_compile
Normal 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
|
Loading…
Reference in New Issue
Block a user