Permalink
Browse files

Fab file changes

  • Loading branch information...
1 parent 50a0244 commit 7551dd1aa44ab09b9c0972ffe97fa51dbf8f71e1 @dstegelman dstegelman committed Oct 5, 2011
Showing with 36 additions and 13 deletions.
  1. +36 −13 conf/fabfile.py
View
@@ -6,7 +6,12 @@
env.id = PROJECT_ID
env.user = PROJECT_USER
env.hosts = PROJECT_HOSTS
-
+env.directory = '~/projects/%s' % PROJECT_ID
+env.virtual_dir = '~/.virtualenvs'
+env.static_dir = '~/static/prod'
+env.project_virtual = '~/.virtualenvs/%s' % PROJECT_ID
+env.activate = 'source ~/.virtualenvs/%s/bin/activate' % PROJECT_ID
+env.deploy_user = PROJECT_USER
def setup():
pass
@@ -20,28 +25,22 @@ def run_local():
def push():
local('git push webfaction master')
-
-
-
+
#Server Commands
def pull():
- local('cd ~/projects/%s' % env.id)
- local('git pull origin')
+ with cd(env.directory):
+ run('git pull origin production')
+
def install_requirements():
- local('workon %s' % env.id)
- local('pip install -r ~/projects/%s/conf/requirements.txt')
+ virtualenv('pip install -r conf/requirements.txt')
def deploy():
samuel_l_jackson()
install_requirements()
local('touch ~/projects/%s/conf/%s.wsgi' % env.id)
print('Deployment of %s complete' % env.id)
-
-
-
-
#Utils
def samuel_l_jackson():
local('clear')
@@ -55,4 +54,28 @@ def samuel_l_jackson():
print('')
print('Hold on to yer butts...')
print('')
- print('')
+ print('')
+
+def kick_apache():
+ with cd('~/webapps/django_env/apache2/bin'):
+ run("./restart")
+
+def virtualenv(command):
+ with cd(env.directory):
+ run(env.activate + '&&' + command)
+
+def sync_db(env):
+ if env == "local":
+ local("python manage.py syncdb --settings=settings.local")
+ else:
+ virtualenv('python manage.py syncdb --settings=settings.production')
+
+def migrate(env):
+ if env == "local":
+ local("python manage.py syncdb --settings=settings.local")
+ else:
+ virtualenv('python manage.py migrate --settings=settings.production')
+
+def build_migration(app):
+ local("python manage.py schemamigration %s --settings=settings.local" % app)
+

0 comments on commit 7551dd1

Please sign in to comment.