私はfabric3を使ってdjangoプロジェクトをubuntu(16.04)サーバに配備しています。コードには、必要に応じてディレクトリをmkdir -p
とすることが含まれます。コードスニペット:fabric deploy "mkdir -p"はソケットエラー "no such file or directory"を返しますが、コマンドはsshで動作します
from fabric.api import env, local, run
(...)
def _create_directory_structure_if_necessary(site_folder):
for subfolder in ('database', 'static', 'virtualenv', 'source'):
run(f'mkdir -p {site_folder}/{subfolder}')
私はfab deploy:[email protected]
を実行すると、私は次のエラーを取得する:
[[email protected]] Executing task 'deploy'
[[email protected]] run: mkdir -p /home/ubuntu/sites/my.site.com/database
Fatal error: Low level socket error connecting to host my.site.com on port 22: No such file or directory (tried 1 time)
Underlying exception:
No such file or directory
Aborting.
生成されたディレクトリが正しいであり、このファイル構造は、作業のWebサイトで、すでにそこにあります、サーバー上にあります。サーバーにsshをインストールした場合、mkdir -p /home/ubuntu/sites/my.site.com/database
はエラーなく動作します。なぜコマンドはsshウィンドウでは動作しますが、ファブリックスクリプトでは動作しませんか?
詳細:Amazon Web Services EC2サーバーを使用し、デフォルトのubuntu
ユーザー。アプリはdjango、nginx、gunicorn、Python3.6を使用します。私はハリー・パーシバルの本Test-Driven Development with Pythonに従っています。 Mac OS Xから展開する
あなたのホストセクションを見てください。 http://stackoverflow.com/help/how-to-ask – e4c5