我正在使用管道将所有东西从 BitBucket 推到 Heroku。问题是静态文件,因为我正在使用django- gulp,当我调用collectstatic
.
它首先将代码推送到 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
我需要做的是让 Herokunpm install
在 collectstatic 之前首先运行,否则它将不起作用,但我很难找到任何关于此的文档。
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