From a9e4441bee07a21ca34191e7bb2c87e6af7f7afc Mon Sep 17 00:00:00 2001 From: Zev Benjamin Date: Wed, 12 Jun 2013 13:56:12 -0400 Subject: [PATCH] [manual] Serve static files from the same location across prod deploys This only affects DEPLOYED installations. This does not take care of removing old versions of static files from that directory. The problem is that staticfiles is clever and doesn't copy files that are already there, so we can't depend on mtime for detecting which files we no longer need. Hopefully that won't be too much of a problem for now. (imported from commit 4341460dd5bc6544086fd445014ebdac58192910) --- humbug/settings.py | 7 +++++-- .../puppet/modules/humbug/files/nginx/humbug-include/app | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/humbug/settings.py b/humbug/settings.py index e8360c2267..5c2262e5e0 100644 --- a/humbug/settings.py +++ b/humbug/settings.py @@ -220,15 +220,18 @@ if DEBUG: STATICFILES_FINDERS = ( 'django.contrib.staticfiles.finders.AppDirectoriesFinder', ) + STATIC_ROOT = 'prod-static/serve' else: STATICFILES_STORAGE = 'zephyr.storage.HumbugStorage' STATICFILES_FINDERS = ( 'zephyr.finders.HumbugFinder', ) - + if DEPLOYED: + STATIC_ROOT = '/home/humbug/prod-static' + else: + STATIC_ROOT = 'prod-static/serve' STATIC_HEADER_FILE = 'zephyr/static_header.txt' -STATIC_ROOT = 'prod-static/serve' # This is the default behavior from Pipeline, but we set it # here so that urls.py can read it. diff --git a/servers/puppet/modules/humbug/files/nginx/humbug-include/app b/servers/puppet/modules/humbug/files/nginx/humbug-include/app index 91d869b92f..b9a5b74743 100644 --- a/servers/puppet/modules/humbug/files/nginx/humbug-include/app +++ b/servers/puppet/modules/humbug/files/nginx/humbug-include/app @@ -9,7 +9,7 @@ error_page 502 503 504 /static/html/5xx.html; # Serve static files directly location /static/ { - alias /home/humbug/humbug-deployments/current/prod-static/serve/; + alias /home/humbug/prod-static/; error_page 404 /static/html/404.html; }