Flush memcache when deploying
authorCharles Connell <charles@connells.org>
Sat, 26 Apr 2014 13:01:41 +0000 (09:01 -0400)
committerCharles Connell <charles@connells.org>
Sat, 26 Apr 2014 13:01:41 +0000 (09:01 -0400)
fabfile.py

index bcfa3317d7e0108aeb1d9089e95460fd4b9a3cb3..7bee315b90ce1c9dc12423a519b307479c8189b5 100644 (file)
@@ -201,6 +201,12 @@ def restart_gunicorn():
     """
     supervisorctl('restart', 'gunicorn')
 
+@task
+def flush_memcache():
+    """
+    Clear everything cached in memcached
+    """
+    virtenv_exec('echo "flush_all" | nc localhost 11211')
 
 ####### Update Requirements
 @task
@@ -292,9 +298,11 @@ def first_deploy():
     check_secrets()
     install_reqs()
     syncdb()
+    compress_static()
     collect_static()
     fetch_usde()
     import_usde()
+    flush_memcache()
     start_supervisord()
     print "You should run `manage.py createsuperuser` in the virtual environment"
 
@@ -309,5 +317,6 @@ def deploy():
     syncdb()
     compress_static()
     collect_static()
+    flush_memcache()
     restart_supervisord()
 ########## END COMMANDS