From 362ea2e7f8ac4254398791139cc060090199f400 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Marek=20St=C4=99pniowski?= Date: Mon, 12 Oct 2009 17:09:05 +0200 Subject: [PATCH] Oddzielenie STATIC_URL od MEDIA_URL. --- apps/compress/utils.py | 4 ++-- apps/sponsors/widgets.py | 6 +++--- wolnelektury/settings.py | 4 +++- wolnelektury/{media => static}/css/error.css | 0 .../{media => static}/css/jquery.autocomplete.css | 2 +- wolnelektury/{media => static}/css/master.book.css | 4 ++-- wolnelektury/{media => static}/css/master.css | 6 +++--- wolnelektury/{media => static}/css/master.plain.css | 0 wolnelektury/{media => static}/css/sponsors.css | 0 wolnelektury/{media => static}/img/arrow-down.png | Bin wolnelektury/{media => static}/img/arrow-up.png | Bin wolnelektury/{media => static}/img/bg.png | Bin wolnelektury/{media => static}/img/book-parent.png | Bin wolnelektury/{media => static}/img/book.png | Bin .../img/czytamysluchajac-logo-small.png | Bin wolnelektury/{media => static}/img/favicon.png | Bin wolnelektury/{media => static}/img/footer.png | Bin wolnelektury/{media => static}/img/indicator.gif | Bin wolnelektury/{media => static}/img/logo.png | Bin .../{media => static}/img/wolontariat/01.jpg | Bin .../{media => static}/img/wolontariat/02.jpg | Bin .../{media => static}/img/wolontariat/03.jpg | Bin .../{media => static}/img/wolontariat/04.jpg | Bin .../{media => static}/img/wolontariat/okladka.jpg | Bin wolnelektury/{media => static}/infobar/infobar.css | 0 wolnelektury/{media => static}/infobar/infobar.gif | Bin wolnelektury/{media => static}/infobar/infobar.js | 0 wolnelektury/{media => static}/js/book.js | 0 wolnelektury/{media => static}/js/catalogue.js | 6 +++--- .../{media => static}/js/jquery.autocomplete.js | 0 .../{media => static}/js/jquery.eventdelegation.js | 0 wolnelektury/{media => static}/js/jquery.form.js | 0 .../{media => static}/js/jquery.highlightfade.js | 0 wolnelektury/{media => static}/js/jquery.jqmodal.js | 0 wolnelektury/{media => static}/js/jquery.js | 0 .../{media => static}/js/jquery.labelify.js | 0 .../{media => static}/js/jquery.scrollto.js | 0 .../{media => static}/js/ordered_select_multiple.js | 0 wolnelektury/{media => static}/player.swf | Bin .../{media => static}/sponsors/css/footer_admin.css | 0 .../{media => static}/sponsors/js/footer_admin.js | 0 .../sponsors/js/jquery.json.min.js | 0 wolnelektury/templates/404.html | 4 ++-- wolnelektury/templates/500.html | 4 ++-- wolnelektury/templates/base.html | 10 +++++----- wolnelektury/templates/catalogue/book_detail.html | 8 ++++---- .../templates/catalogue/book_fragments.html | 2 +- wolnelektury/templates/catalogue/book_text.html | 4 ++-- wolnelektury/templates/catalogue/main_page.html | 2 +- .../templates/catalogue/tagged_object_list.html | 2 +- wolnelektury/templates/info/voluntary_services.html | 12 ++++++------ wolnelektury/urls.py | 11 ++++++++--- 52 files changed, 49 insertions(+), 42 deletions(-) rename wolnelektury/{media => static}/css/error.css (100%) rename wolnelektury/{media => static}/css/jquery.autocomplete.css (85%) rename wolnelektury/{media => static}/css/master.book.css (96%) rename wolnelektury/{media => static}/css/master.css (98%) rename wolnelektury/{media => static}/css/master.plain.css (100%) rename wolnelektury/{media => static}/css/sponsors.css (100%) rename wolnelektury/{media => static}/img/arrow-down.png (100%) rename wolnelektury/{media => static}/img/arrow-up.png (100%) rename wolnelektury/{media => static}/img/bg.png (100%) rename wolnelektury/{media => static}/img/book-parent.png (100%) rename wolnelektury/{media => static}/img/book.png (100%) rename wolnelektury/{media => static}/img/czytamysluchajac-logo-small.png (100%) rename wolnelektury/{media => static}/img/favicon.png (100%) rename wolnelektury/{media => static}/img/footer.png (100%) rename wolnelektury/{media => static}/img/indicator.gif (100%) rename wolnelektury/{media => static}/img/logo.png (100%) rename wolnelektury/{media => static}/img/wolontariat/01.jpg (100%) rename wolnelektury/{media => static}/img/wolontariat/02.jpg (100%) rename wolnelektury/{media => static}/img/wolontariat/03.jpg (100%) rename wolnelektury/{media => static}/img/wolontariat/04.jpg (100%) rename wolnelektury/{media => static}/img/wolontariat/okladka.jpg (100%) rename wolnelektury/{media => static}/infobar/infobar.css (100%) rename wolnelektury/{media => static}/infobar/infobar.gif (100%) rename wolnelektury/{media => static}/infobar/infobar.js (100%) rename wolnelektury/{media => static}/js/book.js (100%) rename wolnelektury/{media => static}/js/catalogue.js (96%) rename wolnelektury/{media => static}/js/jquery.autocomplete.js (100%) rename wolnelektury/{media => static}/js/jquery.eventdelegation.js (100%) rename wolnelektury/{media => static}/js/jquery.form.js (100%) rename wolnelektury/{media => static}/js/jquery.highlightfade.js (100%) rename wolnelektury/{media => static}/js/jquery.jqmodal.js (100%) rename wolnelektury/{media => static}/js/jquery.js (100%) rename wolnelektury/{media => static}/js/jquery.labelify.js (100%) rename wolnelektury/{media => static}/js/jquery.scrollto.js (100%) rename wolnelektury/{media => static}/js/ordered_select_multiple.js (100%) rename wolnelektury/{media => static}/player.swf (100%) rename wolnelektury/{media => static}/sponsors/css/footer_admin.css (100%) rename wolnelektury/{media => static}/sponsors/js/footer_admin.js (100%) rename wolnelektury/{media => static}/sponsors/js/jquery.json.min.js (100%) diff --git a/apps/compress/utils.py b/apps/compress/utils.py index 1e0681f07..3c59728b9 100644 --- a/apps/compress/utils.py +++ b/apps/compress/utils.py @@ -58,10 +58,10 @@ def media_root(filename): """ Return the full path to ``filename``. ``filename`` is a relative path name in MEDIA_ROOT """ - return os.path.join(django_settings.MEDIA_ROOT, filename) + return os.path.join(django_settings.STATIC_ROOT, filename) def media_url(url): - return django_settings.MEDIA_URL + urlquote(url) + return django_settings.STATIC_URL + urlquote(url) def concat(filenames, separator=''): """ diff --git a/apps/sponsors/widgets.py b/apps/sponsors/widgets.py index 3bb586bcf..72aaf0a83 100644 --- a/apps/sponsors/widgets.py +++ b/apps/sponsors/widgets.py @@ -10,11 +10,11 @@ class SponsorPageWidget(forms.Textarea): js = ( 'http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js', 'http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.1/jquery-ui.min.js', - settings.MEDIA_URL + 'sponsors/js/jquery.json.min.js', - settings.MEDIA_URL + 'sponsors/js/footer_admin.js', + settings.STATIC_URL + 'sponsors/js/jquery.json.min.js', + settings.STATIC_URL + 'sponsors/js/footer_admin.js', ) css = { - 'all': (settings.MEDIA_URL + 'sponsors/css/footer_admin.css',), + 'all': (settings.STATIC_URL + 'sponsors/css/footer_admin.css',), } def render(self, name, value, attrs=None): diff --git a/wolnelektury/settings.py b/wolnelektury/settings.py index 9e9f6a545..722cd93ab 100644 --- a/wolnelektury/settings.py +++ b/wolnelektury/settings.py @@ -38,12 +38,14 @@ USE_I18N = True # Absolute path to the directory that holds media. # Example: "/home/media/media.lawrence.com/" -MEDIA_ROOT = path.join(PROJECT_DIR, 'media') +MEDIA_ROOT = path.join(PROJECT_DIR, '../media') +STATIC_ROOT = path.join(PROJECT_DIR, 'static') # URL that handles the media served from MEDIA_ROOT. Make sure to use a # trailing slash if there is a path component (optional in other cases). # Examples: "http://media.lawrence.com", "http://example.com/media/" MEDIA_URL = '/media/' +STATIC_URL = '/static/' # URL prefix for admin media -- CSS, JavaScript and images. Make sure to use a # trailing slash. diff --git a/wolnelektury/media/css/error.css b/wolnelektury/static/css/error.css similarity index 100% rename from wolnelektury/media/css/error.css rename to wolnelektury/static/css/error.css diff --git a/wolnelektury/media/css/jquery.autocomplete.css b/wolnelektury/static/css/jquery.autocomplete.css similarity index 85% rename from wolnelektury/media/css/jquery.autocomplete.css rename to wolnelektury/static/css/jquery.autocomplete.css index 9c5a36dfb..434de139d 100644 --- a/wolnelektury/media/css/jquery.autocomplete.css +++ b/wolnelektury/static/css/jquery.autocomplete.css @@ -23,7 +23,7 @@ } .ac_loading { - background: white url(/media/img/indicator.gif) right center no-repeat; + background: white url(/static/img/indicator.gif) right center no-repeat; } .ac_odd { diff --git a/wolnelektury/media/css/master.book.css b/wolnelektury/static/css/master.book.css similarity index 96% rename from wolnelektury/media/css/master.book.css rename to wolnelektury/static/css/master.book.css index a5f791ce6..b0d354296 100644 --- a/wolnelektury/media/css/master.book.css +++ b/wolnelektury/static/css/master.book.css @@ -56,12 +56,12 @@ img { #menu li a:hover, #menu li a:active { color: #000; - background: #FFF url(/media/img/arrow-down.png) no-repeat center right; + background: #FFF url(/static/img/arrow-down.png) no-repeat center right; } #menu li a.selected { color: #000; - background: #FFF url(/media/img/arrow-up.png) no-repeat center right; + background: #FFF url(/static/img/arrow-up.png) no-repeat center right; } #toc, #themes { diff --git a/wolnelektury/media/css/master.css b/wolnelektury/static/css/master.css similarity index 98% rename from wolnelektury/media/css/master.css rename to wolnelektury/static/css/master.css index 34428b2dd..d7d741ac5 100644 --- a/wolnelektury/media/css/master.css +++ b/wolnelektury/static/css/master.css @@ -2,7 +2,7 @@ body { margin: 0 2em 2em 2em; font: 70% Verdana, Arial, Helvetica, sans-serif; line-height: 1.5em; - background: #FFF url(/media/img/bg.png) repeat-x; + background: #FFF url(/static/img/bg.png) repeat-x; color: #2F4110; } @@ -451,14 +451,14 @@ div.shown-tags p, div.all-tags p { } .book-thumbnail, .book-parent-thumbnail { - background: transparent url(/media/img/book.png) no-repeat 0 0; + background: transparent url(/static/img/book.png) no-repeat 0 0; width: 3em; height: 3em; float: left; } .book-parent-thumbnail { - background: transparent url(/media/img/book-parent.png) no-repeat 0 0; + background: transparent url(/static/img/book-parent.png) no-repeat 0 0; } diff --git a/wolnelektury/media/css/master.plain.css b/wolnelektury/static/css/master.plain.css similarity index 100% rename from wolnelektury/media/css/master.plain.css rename to wolnelektury/static/css/master.plain.css diff --git a/wolnelektury/media/css/sponsors.css b/wolnelektury/static/css/sponsors.css similarity index 100% rename from wolnelektury/media/css/sponsors.css rename to wolnelektury/static/css/sponsors.css diff --git a/wolnelektury/media/img/arrow-down.png b/wolnelektury/static/img/arrow-down.png similarity index 100% rename from wolnelektury/media/img/arrow-down.png rename to wolnelektury/static/img/arrow-down.png diff --git a/wolnelektury/media/img/arrow-up.png b/wolnelektury/static/img/arrow-up.png similarity index 100% rename from wolnelektury/media/img/arrow-up.png rename to wolnelektury/static/img/arrow-up.png diff --git a/wolnelektury/media/img/bg.png b/wolnelektury/static/img/bg.png similarity index 100% rename from wolnelektury/media/img/bg.png rename to wolnelektury/static/img/bg.png diff --git a/wolnelektury/media/img/book-parent.png b/wolnelektury/static/img/book-parent.png similarity index 100% rename from wolnelektury/media/img/book-parent.png rename to wolnelektury/static/img/book-parent.png diff --git a/wolnelektury/media/img/book.png b/wolnelektury/static/img/book.png similarity index 100% rename from wolnelektury/media/img/book.png rename to wolnelektury/static/img/book.png diff --git a/wolnelektury/media/img/czytamysluchajac-logo-small.png b/wolnelektury/static/img/czytamysluchajac-logo-small.png similarity index 100% rename from wolnelektury/media/img/czytamysluchajac-logo-small.png rename to wolnelektury/static/img/czytamysluchajac-logo-small.png diff --git a/wolnelektury/media/img/favicon.png b/wolnelektury/static/img/favicon.png similarity index 100% rename from wolnelektury/media/img/favicon.png rename to wolnelektury/static/img/favicon.png diff --git a/wolnelektury/media/img/footer.png b/wolnelektury/static/img/footer.png similarity index 100% rename from wolnelektury/media/img/footer.png rename to wolnelektury/static/img/footer.png diff --git a/wolnelektury/media/img/indicator.gif b/wolnelektury/static/img/indicator.gif similarity index 100% rename from wolnelektury/media/img/indicator.gif rename to wolnelektury/static/img/indicator.gif diff --git a/wolnelektury/media/img/logo.png b/wolnelektury/static/img/logo.png similarity index 100% rename from wolnelektury/media/img/logo.png rename to wolnelektury/static/img/logo.png diff --git a/wolnelektury/media/img/wolontariat/01.jpg b/wolnelektury/static/img/wolontariat/01.jpg similarity index 100% rename from wolnelektury/media/img/wolontariat/01.jpg rename to wolnelektury/static/img/wolontariat/01.jpg diff --git a/wolnelektury/media/img/wolontariat/02.jpg b/wolnelektury/static/img/wolontariat/02.jpg similarity index 100% rename from wolnelektury/media/img/wolontariat/02.jpg rename to wolnelektury/static/img/wolontariat/02.jpg diff --git a/wolnelektury/media/img/wolontariat/03.jpg b/wolnelektury/static/img/wolontariat/03.jpg similarity index 100% rename from wolnelektury/media/img/wolontariat/03.jpg rename to wolnelektury/static/img/wolontariat/03.jpg diff --git a/wolnelektury/media/img/wolontariat/04.jpg b/wolnelektury/static/img/wolontariat/04.jpg similarity index 100% rename from wolnelektury/media/img/wolontariat/04.jpg rename to wolnelektury/static/img/wolontariat/04.jpg diff --git a/wolnelektury/media/img/wolontariat/okladka.jpg b/wolnelektury/static/img/wolontariat/okladka.jpg similarity index 100% rename from wolnelektury/media/img/wolontariat/okladka.jpg rename to wolnelektury/static/img/wolontariat/okladka.jpg diff --git a/wolnelektury/media/infobar/infobar.css b/wolnelektury/static/infobar/infobar.css similarity index 100% rename from wolnelektury/media/infobar/infobar.css rename to wolnelektury/static/infobar/infobar.css diff --git a/wolnelektury/media/infobar/infobar.gif b/wolnelektury/static/infobar/infobar.gif similarity index 100% rename from wolnelektury/media/infobar/infobar.gif rename to wolnelektury/static/infobar/infobar.gif diff --git a/wolnelektury/media/infobar/infobar.js b/wolnelektury/static/infobar/infobar.js similarity index 100% rename from wolnelektury/media/infobar/infobar.js rename to wolnelektury/static/infobar/infobar.js diff --git a/wolnelektury/media/js/book.js b/wolnelektury/static/js/book.js similarity index 100% rename from wolnelektury/media/js/book.js rename to wolnelektury/static/js/book.js diff --git a/wolnelektury/media/js/catalogue.js b/wolnelektury/static/js/catalogue.js similarity index 96% rename from wolnelektury/media/js/catalogue.js rename to wolnelektury/static/js/catalogue.js index 1dbd1b9c1..60f1f4972 100644 --- a/wolnelektury/media/js/catalogue.js +++ b/wolnelektury/static/js/catalogue.js @@ -54,7 +54,7 @@ beforeSubmit: function() { $('#registration-form input[type=submit]') .attr('disabled', 'disabled') - .after(''); + .after(''); }, success: function(response) { if (response.success) { @@ -75,7 +75,7 @@ beforeSubmit: function() { $('#login-form input[type=submit]') .attr('disabled', 'disabled') - .after(''); + .after(''); }, success: function(response) { if (response.success) { @@ -191,7 +191,7 @@ trigger: 'a.jqm-trigger', onShow: function(hash) { var offset = $(hash.t).offset(); - target.html('

Ładowanie

'); + target.html('

Ładowanie

'); hash.w.css({position: 'absolute', left: offset.left, top: offset.top}).show() }, onLoad: function(hash) { $('form', hash.w).ajaxForm({ diff --git a/wolnelektury/media/js/jquery.autocomplete.js b/wolnelektury/static/js/jquery.autocomplete.js similarity index 100% rename from wolnelektury/media/js/jquery.autocomplete.js rename to wolnelektury/static/js/jquery.autocomplete.js diff --git a/wolnelektury/media/js/jquery.eventdelegation.js b/wolnelektury/static/js/jquery.eventdelegation.js similarity index 100% rename from wolnelektury/media/js/jquery.eventdelegation.js rename to wolnelektury/static/js/jquery.eventdelegation.js diff --git a/wolnelektury/media/js/jquery.form.js b/wolnelektury/static/js/jquery.form.js similarity index 100% rename from wolnelektury/media/js/jquery.form.js rename to wolnelektury/static/js/jquery.form.js diff --git a/wolnelektury/media/js/jquery.highlightfade.js b/wolnelektury/static/js/jquery.highlightfade.js similarity index 100% rename from wolnelektury/media/js/jquery.highlightfade.js rename to wolnelektury/static/js/jquery.highlightfade.js diff --git a/wolnelektury/media/js/jquery.jqmodal.js b/wolnelektury/static/js/jquery.jqmodal.js similarity index 100% rename from wolnelektury/media/js/jquery.jqmodal.js rename to wolnelektury/static/js/jquery.jqmodal.js diff --git a/wolnelektury/media/js/jquery.js b/wolnelektury/static/js/jquery.js similarity index 100% rename from wolnelektury/media/js/jquery.js rename to wolnelektury/static/js/jquery.js diff --git a/wolnelektury/media/js/jquery.labelify.js b/wolnelektury/static/js/jquery.labelify.js similarity index 100% rename from wolnelektury/media/js/jquery.labelify.js rename to wolnelektury/static/js/jquery.labelify.js diff --git a/wolnelektury/media/js/jquery.scrollto.js b/wolnelektury/static/js/jquery.scrollto.js similarity index 100% rename from wolnelektury/media/js/jquery.scrollto.js rename to wolnelektury/static/js/jquery.scrollto.js diff --git a/wolnelektury/media/js/ordered_select_multiple.js b/wolnelektury/static/js/ordered_select_multiple.js similarity index 100% rename from wolnelektury/media/js/ordered_select_multiple.js rename to wolnelektury/static/js/ordered_select_multiple.js diff --git a/wolnelektury/media/player.swf b/wolnelektury/static/player.swf similarity index 100% rename from wolnelektury/media/player.swf rename to wolnelektury/static/player.swf diff --git a/wolnelektury/media/sponsors/css/footer_admin.css b/wolnelektury/static/sponsors/css/footer_admin.css similarity index 100% rename from wolnelektury/media/sponsors/css/footer_admin.css rename to wolnelektury/static/sponsors/css/footer_admin.css diff --git a/wolnelektury/media/sponsors/js/footer_admin.js b/wolnelektury/static/sponsors/js/footer_admin.js similarity index 100% rename from wolnelektury/media/sponsors/js/footer_admin.js rename to wolnelektury/static/sponsors/js/footer_admin.js diff --git a/wolnelektury/media/sponsors/js/jquery.json.min.js b/wolnelektury/static/sponsors/js/jquery.json.min.js similarity index 100% rename from wolnelektury/media/sponsors/js/jquery.json.min.js rename to wolnelektury/static/sponsors/js/jquery.json.min.js diff --git a/wolnelektury/templates/404.html b/wolnelektury/templates/404.html index 9831864d2..e51ec8216 100644 --- a/wolnelektury/templates/404.html +++ b/wolnelektury/templates/404.html @@ -5,12 +5,12 @@ 404 - Zagubiona strona w WolneLektury.pl - + - +

Podana strona nie istnieje

Przepraszamy, ale ta strona nie istnieje. Sprawdź czy podałeś dobry adres, lub przejdź do strony głównej. diff --git a/wolnelektury/templates/500.html b/wolnelektury/templates/500.html index 7dc97f78d..8346afe29 100644 --- a/wolnelektury/templates/500.html +++ b/wolnelektury/templates/500.html @@ -5,12 +5,12 @@ 500 - Błąd serwera w WolneLektury.pl - + - +

Błąd serwera

Przepraszamy, ale wystąpił błąd serwera. Na pewno już się nim zajmujemy i postaramy się naprawić tak szybko jak to tylko możliwe. Do tego czasu proponujemy żebyś przeszedł do strony głównej. diff --git a/wolnelektury/templates/base.html b/wolnelektury/templates/base.html index 0f30a9e2f..3b4e8f37d 100644 --- a/wolnelektury/templates/base.html +++ b/wolnelektury/templates/base.html @@ -5,7 +5,7 @@ {% block title %}WolneLektury.pl{% endblock %} - + {% compressed_css "all" %} {% compressed_js "jquery" %} {% compressed_js "all" %} @@ -13,16 +13,16 @@ {% endblock %} - +

{% chunk "top-message" %}