简体   繁体   中英

Activate Virtualenv Wrapper with Capistrano

I am trying to deploy a Django project with Capistrano. Capistrano deploys the code to my server and finishes deploy steps.

But when I try add a custom task like this...

task :collect_static do
  on roles(:app) do |host|
    execute "cd #{release_path}/myproject"
    execute "workon myproject"
    execute "./manage.py collectstatic"
  end
end

after "deploy:updated", "collect_static"

It throws the following error...

02 bash: workon: command not found

After the deploy, if I SSH manually onto server and run workon command it works fine(same user). Just Capistrano doesn't recognise it?

workon is not a program but a shell function from virtualenvwrapper . For bash to find it you have to source virtualenvwrapper.sh in the shell.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM