0

我正在使用管道将所有东西从 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
4

1 回答 1

0

解决方案太简单了!

我需要在 Heroku 上添加另一个 nodejs buildpack 并且它起作用了!下面的例子

在此处输入图像描述

于 2017-05-28T21:18:36.020 回答