Home:ALL Converter>Use pipenv on server with capistrano - Inappropriate ioctl for device

Use pipenv on server with capistrano - Inappropriate ioctl for device

Ask Time:2022-08-31T22:05:25         Author:whitebear

Json Formatter

I have project which uses pipenv.

in local

pipenv works very useful.

$pipenv shell
$python manage.py runserver

I deploy the project with capistrano,

What I want to do is start pipenv shell start uwsgi server.

However when exec this script in capistrano

task :bundle do on roles(:app) do
   execute "/home/ubuntu/.pyenv/shims/pipenv shell"
end  

this error occurs

termios.error: (25, 'Inappropriate ioctl for device')

Trial

I use pipenv run and try this,

task :bundle do on roles(:app) do
   execute "/home/ubuntu/.pyenv/shims/pipenv install"
end
end

task :migrate do on roles(:app) do
    execute "/home/ubuntu/.pyenv/shims/pipenv run python #{release_path}/manage.py makemigrations"
    execute "/home/ubuntu/.pyenv/shims/pipenv run python #{release_path}/manage.py migrate"
end
end

Install is successful however, pip module is not recoginized.

 DEBUG [50051834] Command: /home/ubuntu/.pyenv/shims/pipenv install
 DEBUG [50051834]   Installing dependencies from Pipfile.lock (db4242)...
 DEBUG [50051834]     🐍   ▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉ 0/0 — 00:00:00
 DEBUG [50051834]   
 DEBUG [50051834]   To activate this project's virtualenv, run pipenv shell.
Alternatively, run a command inside the virtualenv with pipenv run.
  INFO [50051834] Finished in 1.239 seconds with exit status 0 (successful).
  INFO [8a6402ea] Running /home/ubuntu/.pyenv/shims/pipenv run python /var/www/html/sokuapi/releases/20220901070724/manage.py makemigrations as [email protected]
 DEBUG [8a6402ea] Command: /home/ubuntu/.pyenv/shims/pipenv run python /var/www/html/sokuapi/releases/20220901070724/manage.py makemigrations
 DEBUG [8a6402ea]   Traceback (most recent call last):
  File "/var/www/html/sokuapi/releases/20220901070724/manage.py", line 11, in main
    from django.core.management import execute_from_command_line
ModuleNotFoundError: No module named 'django'

Author:whitebear,eproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/73557164/use-pipenv-on-server-with-capistrano-inappropriate-ioctl-for-device
yy