【发布时间】:2012-03-29 15:08:28
【问题描述】:
让我们考虑一下这个fabfile
def syncdb():
print(green("Database Synchronization ..."))
with cd('/var/www/project'):
sudo('python manage.py syncdb', user='www-data')
def colstat():
print(green("Collecting Static Files..."))
with cd('/var/www/project'):
sudo('python manage.py collectstatic --noinput', user='www-data')
def httpdrst():
print(green("Restarting Apache..."))
sudo('apachectl restart')
def srefresh():
colstat()
syncdb()
httpdrst()
srefresh 指令调用所有其他指令,其中某些 with cd(...)
在变量中包含这个“cd 路径”的最佳方法是什么?
def colstat():
with cd(env.remote['path']):
def srefresh():
env.remote['path'] = '/var/www/project'
colstat()
syncdb()
httpdrst()
类似的东西?
【问题讨论】:
标签: python django deployment fabric