Platform.sh未能本地构建。它无法找到项目文件

问题描述 投票:0回答:1

我与Platform.sh试验,并试图本地构建我的项目下的documentation。但构建失败,显然它无法找到项目文件:

Could not open requirements file: [Errno 2] No such file or directory: 'requirements.txt'

我曾尝试git commit代码事前,但仍没有运气。下面是完整的回溯,我得到:

$ platform local:build                                                                                   Mon 11 Feb 2019 12:28:09 -02
Building application app (runtime type: python:3.6)
Installing python3 dependencies with 'pip': pipenv
Looking in indexes: http://localhost:3141/root/pypi/+simple/
Collecting pipenv==2018.10.13 (from -r requirements.txt (line 1))
  Downloading http://localhost:3141/root/pypi/+f/d5a/c9a7705c654ec/pipenv-2018.10.13-py3-none-any.whl (5.2MB)
    100% |████████████████████████████████| 5.2MB 37.8MB/s 
Requirement already satisfied: pip>=9.0.1 in /home/user/.local/share/virtualenvs/space-app-phFju0DF/lib/python3.6/site-packages (from pipenv==2018.10.13->-r requirements.txt (line 1)) (10.0.1)
Collecting certifi (from pipenv==2018.10.13->-r requirements.txt (line 1))
  Downloading http://localhost:3141/root/pypi/+f/993/f830721089fef/certifi-2018.11.29-py2.py3-none-any.whl (154kB)
    100% |████████████████████████████████| 163kB 36.9MB/s 
Collecting virtualenv-clone>=0.2.5 (from pipenv==2018.10.13->-r requirements.txt (line 1))
  Downloading http://localhost:3141/root/pypi/+f/f2a/07ed255f3abac/virtualenv_clone-0.5.1-py3-none-any.whl
Requirement already satisfied: setuptools>=36.2.1 in /home/user/.local/share/virtualenvs/space-app-phFju0DF/lib/python3.6/site-packages (from pipenv==2018.10.13->-r requirements.txt (line 1)) (39.1.0)
Collecting virtualenv (from pipenv==2018.10.13->-r requirements.txt (line 1))
  Downloading http://localhost:3141/root/pypi/+f/8b9/abfc51c38b70f/virtualenv-16.4.0-py2.py3-none-any.whl (2.0MB)
    100% |████████████████████████████████| 2.0MB 34.0MB/s 
Installing collected packages: certifi, virtualenv-clone, virtualenv, pipenv
  The script virtualenv-clone is installed in './bin' which is not on PATH.
  Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
  The script virtualenv is installed in './bin' which is not on PATH.
  Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
  The scripts pipenv and pipenv-resolver are installed in './bin' which is not on PATH.
  Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
Successfully installed certifi-2018.11.29 pipenv-2018.10.13 virtualenv-16.4.0 virtualenv-clone-0.5.1
Running post-build hooks
Could not open requirements file: [Errno 2] No such file or directory: 'requirements.txt'
python: can't open file 'manage.py': [Errno 2] No such file or directory
Backing up previous build to: /home/user/Dev/space-app/.platform/local/builds/default-old.tar.gz
Creating symbolic links to mimic shared file mounts
  Symlinking logs to .platform/local/shared/logs

Build complete for application app
Web root: /home/user/Dev/space-app/_www

Cleaning up...

EDIT

我加入我的.platform.app.yaml

name: 'app'

type: 'python:3.6'

dependencies:
    python3:
        pip: '19.0.2'
        # pipenv: '2018.10.13'

relationships:
    database: "postgresqldb:postgresql"

web:
    upstream:
        socket_family: unix
    commands:
        start: "gunicorn -w 4 -b unix:$SOCKET myapp.wsgi:application"
    locations:
        "/":
            passthru: true
        "/static":
            root: "static"
            expires: 1h
            allow: true

disk: 512

mounts:
    'logs':
        source: local
        source_path: logs

hooks:
    build: |
        pip install -r requirements.txt
        # pipenv install --system --deploy

        mkdir logs
        python manage.py collectstatic
        rm -rf logs
    deploy: |
        python manage.py migrate

提前致谢。

build local platform
1个回答
1
投票

我非常建议得到某种运行的virtualenv的..和你已经安装pipenv ......我不会混系统Python和这个项目的蟒蛇...

下面应该很好地工作在本地和服务器上...

hooks:
    build: |
        pipenv install -r requirements.txt
        pipenv run python manage.py collectstatic
    deploy: |
        pipenv run python manage.py migrate
© www.soinside.com 2019 - 2024. All rights reserved.