Skip to content

Commit

Permalink
Remove post_compile call from Procfile and update it to run bower
Browse files Browse the repository at this point in the history
  • Loading branch information
mazulo committed Aug 1, 2021
1 parent 48e1dcd commit 9a4c308
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 7 deletions.
3 changes: 1 addition & 2 deletions Procfile
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
release: bin/post_compile
web: gunicorn backend.wsgi --log-file -
web: gunicorn backend.wsgi --log-file -
36 changes: 33 additions & 3 deletions app.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,45 @@
{
"name": "DjangoBoilerplate",
"addons": [
{
"plan": "heroku-postgresql:hobby-dev",
"options": {
"version": "13"
},
"as": "DATABASE"
}
],
"env": {
"DJANGO_DEBUG": "1",
"ALLOWED_HOSTS": {
"description": "Django ALLOWED_HOSTS setting, e.g.: .appname.herokuapp.com"
},
"DJANGO_SECRET_KEY": {
"generator": "secret"
},
"DJANGO_SETTINGS_MODULE": {
"description": "Django settings Python import path",
"value": "settings.production"
},
"DISABLE_COLLECTSTATIC": {
"description": "Disables django collectstatic",
"value": "1"
},
"ENABLE_DJANGO_COLLECTSTATIC": {
"description": "Enables collectstatic to be run by post_compile",
"value": "1"
},
"AUTO_MIGRATION": {
"description": "Setting to run migrate automatically by post_compile",
"value": "1"
}
},
"buildpacks": [
{"url": "heroku/nodejs"},
{"url": "heroku/python"}
{
"url": "heroku/nodejs"
},
{
"url": "heroku/python"
}
]
}
}
19 changes: 17 additions & 2 deletions bin/post_compile
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
# !/usr/bin/env bash
echo "=> Performing database migrations..."
python manage.py migrate
echo "====> Running post-compile hook..."

if [ -n "$ENABLE_DJANGO_COLLECTSTATIC" ] && [ "$ENABLE_DJANGO_COLLECTSTATIC" == 1 ]; then
echo "=====> Running bower install"
./node_modules/.bin/bower install

echo "=====> Running collectstatic"
python manage.py collectstatic --noinput
fi

echo "=====> Running manage.py check --deploy --fail-level WARNING"
python manage.py check --deploy --fail-level WARNING

if [ -n "$AUTO_MIGRATION" ] && [ "$AUTO_MIGRATION" == 1 ]; then
echo "=====> Running manage.py migrate"
python manage.py migrate --noinput
fi

0 comments on commit 9a4c308

Please sign in to comment.