Better paths on S3
authorCharles Connell <charles@connells.org>
Sat, 26 Apr 2014 00:53:57 +0000 (20:53 -0400)
committerCharles Connell <charles@connells.org>
Sat, 26 Apr 2014 00:53:57 +0000 (20:53 -0400)
karmaworld/assets/css/ajax_select.css
karmaworld/assets/css/font-awesome.css
karmaworld/assets/css/fontface.css
karmaworld/assets/css/home.css
karmaworld/assets/css/jquery-ui.css
karmaworld/assets/css/jquery.dataTables.css
karmaworld/settings/prod.py
karmaworld/settings/vmdev.py

index f751a0afc21201b46bb19e35ad35f0ea4e8efd6e..b50f7043939bc87c4ac11d046cadc9c0382ba8bf 100644 (file)
@@ -13,7 +13,7 @@ form .aligned .results_on_deck {
        margin-bottom: 0.5em;
 }
 .ui-autocomplete-loading {
-       background:  url('//karma-prod.s3.amazonaws.com/css/images/loading-indicator.gif') no-repeat;
+       background:  url('/static/css/images/loading-indicator.gif') no-repeat;
     background-origin: content-box;
        background-position: right;
 }
index 4da18eb136c4d1dee09ffc9473b05e4a7ac1b9c1..fad7ee3e92b1303fe576711fdd9f6715429907c0 100644 (file)
@@ -6,11 +6,11 @@
  * -------------------------- */
 @font-face {
   font-family: 'FontAwesome';
-  src: url('//karma-prod.s3.amazonaws.com/css/fonts/fontawesome-webfont.eot?v=4.0.3');
-  src: url('//karma-prod.s3.amazonaws.com/css/fonts/fontawesome-webfont.eot?#iefix&v=4.0.3') format('embedded-opentype'),
-    url('//karma-prod.s3.amazonaws.com/css/fonts/fontawesome-webfont.woff?v=4.0.3') format('woff'),
-    url('//karma-prod.s3.amazonaws.com/css/fonts/fontawesome-webfont.ttf?v=4.0.3') format('truetype'),
-    url('//karma-prod.s3.amazonaws.com/css/fonts/fontawesome-webfont.svg?v=4.0.3#fontawesomeregular') format('svg');
+  src: url('/static/css/fonts/fontawesome-webfont.eot?v=4.0.3');
+  src: url('/static/css/fonts/fontawesome-webfont.eot?#iefix&v=4.0.3') format('embedded-opentype'),
+    url('/static/css/fonts/fontawesome-webfont.woff?v=4.0.3') format('woff'),
+    url('/static/css/fonts/fontawesome-webfont.ttf?v=4.0.3') format('truetype'),
+    url('/static/css/fonts/fontawesome-webfont.svg?v=4.0.3#fontawesomeregular') format('svg');
   font-weight: normal;
   font-style: normal;
 }
index e73bbe4f1103df4ca101c302479e3ef84db9f021..567e44202dff4b52fd1baecdcd997be3bd82080a 100644 (file)
@@ -2,22 +2,22 @@
 
 @font-face {
     font-family: 'museo700';
-    src: url('//karma-prod.s3.amazonaws.com/css/fonts/museo700-regular-webfont.eot');
-    src: url('//karma-prod.s3.amazonaws.com/css/fonts/museo700-regular-webfont.eot?#iefix') format('embedded-opentype'),
-         url('//karma-prod.s3.amazonaws.com/css/fonts/museo700-regular-webfont.woff') format('woff'),
-         url('//karma-prod.s3.amazonaws.com/css/fonts/museo700-regular-webfont.ttf') format('truetype'),
-         url('//karma-prod.s3.amazonaws.com/css/fonts/museo700-regular-webfont.svg#museo700') format('svg');
+    src: url('/static/css/fonts/museo700-regular-webfont.eot');
+    src: url('/static/css/fonts/museo700-regular-webfont.eot?#iefix') format('embedded-opentype'),
+         url('/static/css/fonts/museo700-regular-webfont.woff') format('woff'),
+         url('/static/css/fonts/museo700-regular-webfont.ttf') format('truetype'),
+         url('/static/css/fonts/museo700-regular-webfont.svg#museo700') format('svg');
     font-weight: normal;
     font-style: normal;
 }
 
 @font-face {
     font-family: 'museo300';
-    src: url('//karma-prod.s3.amazonaws.com/css/fonts/museo300-regular-webfont.eot');
-    src: url('//karma-prod.s3.amazonaws.com/css/fonts/museo300-regular-webfont.eot?#iefix') format('embedded-opentype'),
-         url('//karma-prod.s3.amazonaws.com/css/fonts/museo300-regular-webfont.woff') format('woff'),
-         url('//karma-prod.s3.amazonaws.com/css/fonts/museo300-regular-webfont.ttf') format('truetype'),
-         url('//karma-prod.s3.amazonaws.com/css/fonts/museo300-regular-webfont.svg#museo300') format('svg');
+    src: url('/static/css/fonts/museo300-regular-webfont.eot');
+    src: url('/static/css/fonts/museo300-regular-webfont.eot?#iefix') format('embedded-opentype'),
+         url('/static/css/fonts/museo300-regular-webfont.woff') format('woff'),
+         url('/static/css/fonts/museo300-regular-webfont.ttf') format('truetype'),
+         url('/static/css/fonts/museo300-regular-webfont.svg#museo300') format('svg');
     font-weight: normal;
     font-style: normal;
 }
index 2d1ba03064bb3f919c0b30d285c0d0be5c70f05b..2e1afe59cc0d8f27a2f78099477fca2c93394e2c 100644 (file)
@@ -9,13 +9,13 @@
 
 @media only screen and (max-width: 500px) {
   #splash {
-    background-image: url('//karma-prod.s3.amazonaws.com/img/banner_small.jpg');
+    background-image: url('/static/img/banner_small.jpg');
   }
 }
 
 @media only screen and (min-width: 501px) {
   #splash {
-    background-image: url('//karma-prod.s3.amazonaws.com/img/banner_large.jpg');
+    background-image: url('/static/img/banner_large.jpg');
   }
 }
 
index 46e68e3eac26b9828b778a7ede0fa0c1bdab206b..983acc57a43d09e5ff9d423510b30a90fc3a1c12 100644 (file)
 }
 .ui-widget-content {
        border: 1px solid #dddddd;
-       background: #eeeeee url("//karma-prod.s3.amazonaws.com/css/images/ui-bg_highlight-soft_100_eeeeee_1x100.png") 50% top repeat-x;
+       background: #eeeeee url("/static/css/images/ui-bg_highlight-soft_100_eeeeee_1x100.png") 50% top repeat-x;
        color: #333333;
 }
 .ui-widget-content a {
 }
 .ui-widget-header {
        border: 1px solid #e78f08;
-       background: #f6a828 url("//karma-prod.s3.amazonaws.com/css/images/ui-bg_gloss-wave_35_f6a828_500x100.png") 50% 50% repeat-x;
+       background: #f6a828 url("/static/css/images/ui-bg_gloss-wave_35_f6a828_500x100.png") 50% 50% repeat-x;
        color: #ffffff;
        font-weight: bold;
 }
 .ui-widget-content .ui-state-default,
 .ui-widget-header .ui-state-default {
        border: 1px solid #cccccc;
-       background: #f6f6f6 url("//karma-prod.s3.amazonaws.com/css/images/ui-bg_glass_100_f6f6f6_1x400.png") 50% 50% repeat-x;
+       background: #f6f6f6 url("/static/css/images/ui-bg_glass_100_f6f6f6_1x400.png") 50% 50% repeat-x;
        font-weight: bold;
        color: #1c94c4;
 }
 .ui-widget-content .ui-state-focus,
 .ui-widget-header .ui-state-focus {
        border: 1px solid #fbcb09;
-       background: #fdf5ce url("//karma-prod.s3.amazonaws.com/css/images/ui-bg_glass_100_fdf5ce_1x400.png") 50% 50% repeat-x;
+       background: #fdf5ce url("/static/css/images/ui-bg_glass_100_fdf5ce_1x400.png") 50% 50% repeat-x;
        font-weight: bold;
        color: #c77405;
 }
 .ui-widget-content .ui-state-active,
 .ui-widget-header .ui-state-active {
        border: 1px solid #fbd850;
-       background: #ffffff url("//karma-prod.s3.amazonaws.com/css/images/ui-bg_glass_65_ffffff_1x400.png") 50% 50% repeat-x;
+       background: #ffffff url("/static/css/images/ui-bg_glass_65_ffffff_1x400.png") 50% 50% repeat-x;
        font-weight: bold;
        color: #eb8f00;
 }
 .ui-widget-content .ui-state-highlight,
 .ui-widget-header .ui-state-highlight {
        border: 1px solid #fed22f;
-       background: #ffe45c url("//karma-prod.s3.amazonaws.com/css/images/ui-bg_highlight-soft_75_ffe45c_1x100.png") 50% top repeat-x;
+       background: #ffe45c url("/static/css/images/ui-bg_highlight-soft_75_ffe45c_1x100.png") 50% top repeat-x;
        color: #363636;
 }
 .ui-state-highlight a,
 .ui-widget-content .ui-state-error,
 .ui-widget-header .ui-state-error {
        border: 1px solid #cd0a0a;
-       background: #b81900 url("//karma-prod.s3.amazonaws.com/css/images/ui-bg_diagonals-thick_18_b81900_40x40.png") 50% 50% repeat;
+       background: #b81900 url("/static/css/images/ui-bg_diagonals-thick_18_b81900_40x40.png") 50% 50% repeat;
        color: #ffffff;
 }
 .ui-state-error a,
 }
 .ui-icon,
 .ui-widget-content .ui-icon {
-       background-image: url("//karma-prod.s3.amazonaws.com/css/images/ui-icons_222222_256x240.png");
+       background-image: url("/static/css/images/ui-icons_222222_256x240.png");
 }
 .ui-widget-header .ui-icon {
-       background-image: url("//karma-prod.s3.amazonaws.com/css/images/ui-icons_ffffff_256x240.png");
+       background-image: url("/static/css/images/ui-icons_ffffff_256x240.png");
 }
 .ui-state-default .ui-icon {
-       background-image: url("//karma-prod.s3.amazonaws.com/css/images/ui-icons_ef8c08_256x240.png");
+       background-image: url("/static/css/images/ui-icons_ef8c08_256x240.png");
 }
 .ui-state-hover .ui-icon,
 .ui-state-focus .ui-icon {
-       background-image: url("//karma-prod.s3.amazonaws.com/css/images/ui-icons_ef8c08_256x240.png");
+       background-image: url("/static/css/images/ui-icons_ef8c08_256x240.png");
 }
 .ui-state-active .ui-icon {
-       background-image: url("//karma-prod.s3.amazonaws.com/css/images/ui-icons_ef8c08_256x240.png");
+       background-image: url("/static/css/images/ui-icons_ef8c08_256x240.png");
 }
 .ui-state-highlight .ui-icon {
-       background-image: url("//karma-prod.s3.amazonaws.com/css/images/ui-icons_228ef1_256x240.png");
+       background-image: url("/static/css/images/ui-icons_228ef1_256x240.png");
 }
 .ui-state-error .ui-icon,
 .ui-state-error-text .ui-icon {
-       background-image: url("//karma-prod.s3.amazonaws.com/css/images/ui-icons_ffd27a_256x240.png");
+       background-image: url("/static/css/images/ui-icons_ffd27a_256x240.png");
 }
 
 /* positioning */
 
 /* Overlays */
 .ui-widget-overlay {
-       background: #666666 url("//karma-prod.s3.amazonaws.com/css/images/ui-bg_diagonals-thick_20_666666_40x40.png") 50% 50% repeat;
+       background: #666666 url("/static/css/images/ui-bg_diagonals-thick_20_666666_40x40.png") 50% 50% repeat;
        opacity: .5;
        filter: Alpha(Opacity=50);
 }
 .ui-widget-shadow {
        margin: -5px 0 0 -5px;
        padding: 5px;
-       background: #000000 url("//karma-prod.s3.amazonaws.com/css/images/ui-bg_flat_10_000000_40x100.png") 50% 50% repeat-x;
+       background: #000000 url("/static/css/images/ui-bg_flat_10_000000_40x100.png") 50% 50% repeat-x;
        opacity: .2;
        filter: Alpha(Opacity=20);
        border-radius: 5px;
index 71fff7c9a65cda00116a913b023d40902f115852..da738002b3538a24d26cb7d12e7245283897c130 100644 (file)
@@ -124,13 +124,13 @@ table.dataTable tr.even td.sorting_3 { background-color: #F9F9FF; }
        margin-left: 10px;
 }
 
-.paginate_enabled_previous { background: url('//karma-prod.s3.amazonaws.com/css/images/back_enabled.png') no-repeat top left; }
-.paginate_enabled_previous:hover { background: url('//karma-prod.s3.amazonaws.com/css/images/back_enabled_hover.png') no-repeat top left; }
-.paginate_disabled_previous { background: url('//karma-prod.s3.amazonaws.com/css/images/back_disabled.png') no-repeat top left; }
+.paginate_enabled_previous { background: url('/static/css/images/back_enabled.png') no-repeat top left; }
+.paginate_enabled_previous:hover { background: url('/static/css/images/back_enabled_hover.png') no-repeat top left; }
+.paginate_disabled_previous { background: url('/static/css/images/back_disabled.png') no-repeat top left; }
 
-.paginate_enabled_next { background: url('//karma-prod.s3.amazonaws.com/css/images/forward_enabled.png') no-repeat top right; }
-.paginate_enabled_next:hover { background: url('//karma-prod.s3.amazonaws.com/css/images/forward_enabled_hover.png') no-repeat top right; }
-.paginate_disabled_next { background: url('//karma-prod.s3.amazonaws.com/css/images/forward_disabled.png') no-repeat top right; }
+.paginate_enabled_next { background: url('/static/css/images/forward_enabled.png') no-repeat top right; }
+.paginate_enabled_next:hover { background: url('/static/css/images/forward_enabled_hover.png') no-repeat top right; }
+.paginate_disabled_next { background: url('/static/css/images/forward_disabled.png') no-repeat top right; }
 
 /* Full number pagination */
 .paging_full_numbers {
@@ -194,12 +194,12 @@ table.dataTable tr.even td.sorting_3 { background-color: #F9F9FF; }
 /*
  * Sorting
  */
-.sorting { background: url('//karma-prod.s3.amazonaws.com/css/images/sort_both.png') no-repeat center right; }
-.sorting_asc { background: url('//karma-prod.s3.amazonaws.com/css/images/sort_asc.png') no-repeat center right; }
-.sorting_desc { background: url('//karma-prod.s3.amazonaws.com/css/images/sort_desc.png') no-repeat center right; }
+.sorting { background: url('/static/css/images/sort_both.png') no-repeat center right; }
+.sorting_asc { background: url('/static/css/images/sort_asc.png') no-repeat center right; }
+.sorting_desc { background: url('/static/css/images/sort_desc.png') no-repeat center right; }
 
-.sorting_asc_disabled { background: url('//karma-prod.s3.amazonaws.com/css/images/sort_asc_disabled.png') no-repeat center right; }
-.sorting_desc_disabled { background: url('//karma-prod.s3.amazonaws.com/css/images/sort_desc_disabled.png') no-repeat center right; }
+.sorting_asc_disabled { background: url('/static/css/images/sort_asc_disabled.png') no-repeat center right; }
+.sorting_desc_disabled { background: url('/static/css/images/sort_desc_disabled.png') no-repeat center right; }
  
 table.dataTable thead th:active,
 table.dataTable thead td:active {
index a6cedce7f5b4fc6640fa9790646fe0afcb5c941c..8a79ab62c05fff384f3e1e0ea7b92cd00723d19a 100644 (file)
@@ -2,8 +2,6 @@
 # -*- coding:utf8 -*-
 # Copyright (C) 2012  FinalsClub Foundation
 """ Production settings and globals. """
-
-
 from os import environ
 from datetime import timedelta
 from S3 import CallingFormat
@@ -127,6 +125,11 @@ INSTALLED_APPS += (
 # DEFAULT_FILE_STORAGE comes from karmaworld.secret.static_s3
 STATICFILES_STORAGE = DEFAULT_FILE_STORAGE
 
+# Put static files in the folder 'static' in our S3 bucket.
+# This is so they have the same path as they do when served
+# locally for development.
+AWS_LOCATION = 'static'
+
 # See: http://django-storages.readthedocs.org/en/latest/backends/amazon-S3.html#settings
 AWS_CALLING_FORMAT = CallingFormat.SUBDOMAIN
 
@@ -139,7 +142,7 @@ AWS_HEADERS = {
 
 # See: https://docs.djangoproject.com/en/dev/ref/settings/#static-url
 # S3_URL comes from karmaworld.secret.static_s3
-STATIC_URL = CLOUDFRONT_URL
+STATIC_URL = CLOUDFRONT_URL + '/' + AWS_LOCATION + '/'
 ########## END STORAGE CONFIGURATION
 
 ########## SSL FORWARDING CONFIGURATION
index d83a3810cdc5322cd61c152c3d80227384a4f1d8..9c1eb1b9b366f14f0d0c777b84931655167be8ca 100644 (file)
@@ -131,6 +131,10 @@ STATICFILES_STORAGE = DEFAULT_FILE_STORAGE
 # See: http://django-storages.readthedocs.org/en/latest/backends/amazon-S3.html#settings
 AWS_CALLING_FORMAT = CallingFormat.SUBDOMAIN
 
+# Put static files in the folder 'static' in our S3 bucket.
+# This is so they have the same path as they do when served
+# locally for development.
+AWS_LOCATION = 'static'
 
 # AWS cache settings, don't change unless you know what you're doing:
 AWS_EXPIREY = 60 * 60 * 24 * 7
@@ -140,7 +144,7 @@ AWS_HEADERS = {
 }
 
 # See: https://docs.djangoproject.com/en/dev/ref/settings/#static-url
-STATIC_URL = S3_URL
+STATIC_URL = CLOUDFRONT_URL + '/' + AWS_LOCATION + '/'
 ########## END STORAGE CONFIGURATION