我正在使用Pipelines将所有内容从BitBucket推送到Heroku。问题是静态文件,因为我使用django-gulp,当我调用collectstatic
时,它将编译所有sass文件(使用nodejs和gulp)。
首先将代码推送到Heroku并运行它,但事实证明所有其他脚本(pip install,npm install,...)将在BitBucket端执行,而不是Heroku。我的Profile
里面有这个:
web: gunicorn magistrska_web.wsgi --log-file -
网站正在运行,但没有静态文件。
如果始终使用DISABLE_COLLECTSTATIC=1
,则会收到以下内容
remote: -----> $ python manage.py collectstatic --noinput
remote: /bin/sh: 1: gulp: not found
我需要做的是让Heroku在collectstatic之前首先运行npm install
,否则它将无效,但我很难找到相关文档。
heroku local web
工作正常,因为我在本地之前运行了collectstatic
。
bitbucket-pipelines.yml
配置:
image: nikolaik/python-nodejs
pipelines:
default:
- step:
script:
- git push https://heroku:$HEROKU_API_KEY@git.heroku.com/$HEROKU_APP_NAME.git HEAD
- pip install -r requirements.txt
- npm install
- npm install -g gulp
- python manage.py collectstatic --noinput