I'm running fabric (Django deployment to apache) and everythin开发者_开发问答g seems to work fine until I get to the task for installing the site:
def install_site():
"Add the virtualhost file to apache"
require('release', provided_by=[deploy, setup])
sudo('cd %(path)/releases/%(release)/%(release); cp %(project_name)/%(virtualhost_path)/%(project_domain) /etc/apache2/sites-available/%(project_domain)s')
sudo('cd /etc/apache2/sites-available; a2ensite %(project_domain)')
I keep getting this error:
[173.203.124.16] sudo: cd %(path)/releases/%(release)/%(release);
[173.203.124.16] err: /bin/bash: -c: line 0: syntax error near unexpected token
`('
[173.203.124.16] err: /bin/bash: -c: line 0: `cd %(path)/releases/%(release)/%(r
elease);'
Warning: sudo() encountered an error (return code 2) while executing 'cd %(path)
/releases/%(release)/%(release);'
I've gone through the fabfile.py over and over and I can't see why the error is coming...any ideas?
def install_site():
"Add the virtualhost file to apache"
require('release', provided_by=[deploy, setup])
with cd('%(path)s/releases/%(release)s/%(release)s' % env):
sudo('cp %(project_name)s/%(virtualhost_path)s/%(project_domain)s '
'/etc/apache2/sites-available/%(project_domain)s' % env)
with cd('/etc/apache2/sites-available'):
sudo('a2ensite %(project_domain)s' % env)
You might want to try using the cd context manager. You're probably also having problems with your string interpolation.
def install_site():
# Add the virtualhost file to apache
require('release', provided_by=[deploy, setup])
with cd('%s/releases/%s/%s' % (path, release, release)):
sudo('cp %s/%s/%s /etc/apache2/sites-available/%s' % (project_name, virtualhost_path, project_domain, project_domain))
with cd('/etc/apache2/sites-available'):
sudo('a2ensite %s' % project_domain)
problem fixed, noticing something with the "hg archive .." command, it zips/tars the repo 2 levels deep
local('hg archive --type=tgz %(release)s.tar.gz' % {'release': env.release})
results in 20100418105144.tar.gz which when u open is structured like this:
20100418105144.tar.gz
/20100418105144
/repo
精彩评论