#
def localhost():
config.fab_hosts = ['localhost']
config.path = '/home/john/saebyn'
config.env_path = '/usr/local/pythonenv/'
config.env_name = 'SAEBYN-1'
config.fab_user = 'john'
def local_test():
localhost()
local('source $(env_path)/$(env_name)/bin/activate; cd $(path)/website; ./manage.py runserver --settings=local_settings')
def test():
"""Production server settings"""
config.fab_hosts = ['saebyn.info']
config.path = '/home/www/test.saebyn.info'
config.fab_user = 'john'
config.env_path = '/usr/local/pythonenv/'
config.env_name = 'SAEBYN-1'
def production():
"""Production server settings"""
config.fab_hosts = ['saebyn.info']
config.path = '/home/www/saebyn.info'
config.fab_user = 'john'
config.env_path = '/usr/local/pythonenv/'
config.env_name = 'SAEBYN-1'
def setup():
"""
Setup a fresh virtualenv and install everything we need so it's ready to
deploy to
"""
create_virtualenv()
install_requirements()
def create_virtualenv():
sudo('mkdir -p $(env_path)')
sudo('cd $(env_path); virtualenv $(env_name)')
sudo('cd $(env_path); chown -R $(fab_user) $(env_name)')
def install_requirements():
"""Install the required packages using pip"""
run('cd $(env_path)/$(env_name); pip install -E . -r $(path)/requirements.txt')
def deploy():
"""Deploy the latest version of the site to the server and restart apache"""
push_live()
migrate()
restart_apache()
def push_live():
"""Rebase 'live' using 'master', push it."""
local('git checkout live')
local('git rebase master')
local('git push origin live')
local('git checkout master')
def migrate():
"""Run our migrations"""
run('source $(env_path)/$(env_name)/bin/activate; cd $(path)/website; python manage.py syncdb --noinput --migrate')
def restart_apache():
"""Restart the web server"""
sudo('/etc/init.d/apache2 restart')
python
1
#deflocalhost():config.fab_hosts=['localhost']config.path='/home/john/saebyn'config.env_path='/usr/local/pythonenv/'config.env_name='SAEBYN-1'config.fab_user='john'deflocal_test():localhost()local('source $(env_path)/$(env_name)/bin/activate; cd $(path)/website; ./manage.py runserver --settings=local_settings')deftest():"""Production server settings"""config.fab_hosts=['saebyn.info']config.path='/home/www/test.saebyn.info'config.fab_user='john'config.env_path='/usr/local/pythonenv/'config.env_name='SAEBYN-1'defproduction():"""Production server settings"""config.fab_hosts=['saebyn.info']config.path='/home/www/saebyn.info'config.fab_user='john'config.env_path='/usr/local/pythonenv/'config.env_name='SAEBYN-1'defsetup():""" Setup a fresh virtualenv and install everything we need so it's ready to deploy to """create_virtualenv()install_requirements()defcreate_virtualenv():sudo('mkdir -p $(env_path)')sudo('cd $(env_path); virtualenv $(env_name)')sudo('cd $(env_path); chown -R $(fab_user) $(env_name)')definstall_requirements():"""Install the required packages using pip"""run('cd $(env_path)/$(env_name); pip install -E . -r $(path)/requirements.txt')defdeploy():"""Deploy the latest version of the site to the server and restart apache"""push_live()migrate()restart_apache()defpush_live():"""Rebase 'live' using 'master', push it."""local('git checkout live')local('git rebase master')local('git push origin live')local('git checkout master')defmigrate():"""Run our migrations"""run('source $(env_path)/$(env_name)/bin/activate; cd $(path)/website; python manage.py syncdb --noinput --migrate')defrestart_apache():"""Restart the web server"""sudo('/etc/init.d/apache2 restart')
Hey there! I see you're running Internet Explorer 6.
That's neat. This reminds me of my grandpa. He had this old car that he kept having to fix. He spent so much money on it that he didn't want to get rid of it (even when it stopped running).
0 Comments