From: Charles Connell Date: Sat, 26 Apr 2014 00:53:57 +0000 (-0400) Subject: Better paths on S3 X-Git-Tag: release-20150131~118 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=ff765a53f65b2bf29035d4e54975eb36dcd9890a;p=oweals%2Fkarmaworld.git Better paths on S3 --- diff --git a/karmaworld/assets/css/ajax_select.css b/karmaworld/assets/css/ajax_select.css index f751a0a..b50f704 100644 --- a/karmaworld/assets/css/ajax_select.css +++ b/karmaworld/assets/css/ajax_select.css @@ -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; } diff --git a/karmaworld/assets/css/font-awesome.css b/karmaworld/assets/css/font-awesome.css index 4da18eb..fad7ee3 100644 --- a/karmaworld/assets/css/font-awesome.css +++ b/karmaworld/assets/css/font-awesome.css @@ -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; } diff --git a/karmaworld/assets/css/fontface.css b/karmaworld/assets/css/fontface.css index e73bbe4..567e442 100644 --- a/karmaworld/assets/css/fontface.css +++ b/karmaworld/assets/css/fontface.css @@ -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; } diff --git a/karmaworld/assets/css/home.css b/karmaworld/assets/css/home.css index 2d1ba03..2e1afe5 100644 --- a/karmaworld/assets/css/home.css +++ b/karmaworld/assets/css/home.css @@ -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'); } } diff --git a/karmaworld/assets/css/jquery-ui.css b/karmaworld/assets/css/jquery-ui.css index 46e68e3..983acc5 100644 --- a/karmaworld/assets/css/jquery-ui.css +++ b/karmaworld/assets/css/jquery-ui.css @@ -180,7 +180,7 @@ } .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 { @@ -188,7 +188,7 @@ } .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; } @@ -202,7 +202,7 @@ .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; } @@ -219,7 +219,7 @@ .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; } @@ -238,7 +238,7 @@ .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; } @@ -255,7 +255,7 @@ .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, @@ -267,7 +267,7 @@ .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, @@ -313,27 +313,27 @@ } .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 */ @@ -546,14 +546,14 @@ /* 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; diff --git a/karmaworld/assets/css/jquery.dataTables.css b/karmaworld/assets/css/jquery.dataTables.css index 71fff7c..da73800 100644 --- a/karmaworld/assets/css/jquery.dataTables.css +++ b/karmaworld/assets/css/jquery.dataTables.css @@ -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 { diff --git a/karmaworld/settings/prod.py b/karmaworld/settings/prod.py index a6cedce..8a79ab6 100644 --- a/karmaworld/settings/prod.py +++ b/karmaworld/settings/prod.py @@ -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 diff --git a/karmaworld/settings/vmdev.py b/karmaworld/settings/vmdev.py index d83a381..9c1eb1b 100644 --- a/karmaworld/settings/vmdev.py +++ b/karmaworld/settings/vmdev.py @@ -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