2020-01-07 14:06:31 +03:00
|
|
|
#!/bin/bash
|
2017-09-05 14:39:20 +03:00
|
|
|
|
|
|
|
set -o errexit
|
|
|
|
set -o pipefail
|
|
|
|
set -o nounset
|
|
|
|
|
|
|
|
|
2015-08-18 18:50:20 +03:00
|
|
|
python /app/manage.py collectstatic --noinput
|
2020-02-28 20:04:15 +03:00
|
|
|
{% if cookiecutter.use_whitenoise == 'y' and cookiecutter.use_compressor == 'y' %}
|
|
|
|
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
|
|
|
|
# NOTE this command will fail if django-compressor is disabled
|
2020-02-11 23:17:50 +03:00
|
|
|
python /app/manage.py compress
|
|
|
|
fi
|
|
|
|
{%- endif %}
|
2022-01-08 01:26:56 +03:00
|
|
|
{%- if cookiecutter.use_async == 'y' %}
|
2020-03-25 04:46:40 +03:00
|
|
|
/usr/local/bin/gunicorn config.asgi --bind 0.0.0.0:5000 --chdir=/app -k uvicorn.workers.UvicornWorker
|
2022-01-08 01:26:56 +03:00
|
|
|
{%- else %}
|
2018-05-14 10:20:27 +03:00
|
|
|
/usr/local/bin/gunicorn config.wsgi --bind 0.0.0.0:5000 --chdir=/app
|
2020-03-24 22:40:14 +03:00
|
|
|
{%- endif %}
|