Platform.sh не может быть собран локально.Он не может найти файлы проекта - PullRequest
0 голосов
/ 11 февраля 2019

Я экспериментирую с Platform.sh и пытаюсь построить свой проект локально, следуя их документации .Но сборка не удалась, очевидно, он не может найти файлы проекта:

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...

РЕДАКТИРОВАТЬ

Я добавляю свой .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

Заранее спасибо.

1 Ответ

0 голосов
/ 11 февраля 2019

Я бы очень предложил запустить какой-нибудь virtualenv .. и поскольку вы уже устанавливаете pipenv ... Я бы не совмещал системный python и python этого проекта ...

Следующее должно работать хорошокак локально, так и на сервере ...

hooks:
    build: |
        pipenv install -r requirements.txt
        pipenv run python manage.py collectstatic
    deploy: |
        pipenv run python manage.py migrate
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...