pip install fabric fabtools python from fabric.api import * from fabric.contrib.files import upload_template from fabtools import require python env.hosts = ['example.com'] env.user = 'username' env.password = 'password' python env.key_filename = '/path/to/ssh/key' python require.python.package('django') python require.nginx.site('example.com', template_source='/path/to/nginx.conf') python run('python manage.py runserver') fab <task_name> python from fabric.api import * from fabric.contrib.files import upload_template from fabtools import require env.hosts = ['example.com'] env.user = 'username' env.password = 'password' def install_packages(): require.python.package('django') def configure_nginx(): require.nginx.site( 'example.com', template_source='/path/to/nginx.conf', ) require.service.started('nginx') def start_application(): run('python manage.py runserver') def deploy(): install_packages() configure_nginx() start_application() fab deploy


上一篇:
下一篇:
切换中文