Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

changed all static use to use django-compressor instead, r=kumar

  • Loading branch information...
commit f525ab43b5f91f51f1083233e6dd3bcfedcdd28e 1 parent abafbf0
Peter Bengtsson authored June 08, 2012
5  bin/update/deploy.py
@@ -43,8 +43,9 @@ def update_locales(ctx):
43 43
 def update_assets(ctx):
44 44
     with ctx.lcd(settings.SRC_DIR):
45 45
         ctx.local("python2.6 manage.py collectstatic --noinput")
46  
-        # LANG=en_US.UTF-8 is sometimes necessary for the YUICompressor.
47  
-        ctx.local('LANG=en_US.UTF8 python2.6 manage.py compress_assets')
  46
+        # un-comment if you haven't moved to django-compressor yet
  47
+        ## LANG=en_US.UTF-8 is sometimes necessary for the YUICompressor.
  48
+        #ctx.local('LANG=en_US.UTF8 python2.6 manage.py compress_assets')
48 49
 
49 50
 
50 51
 @task
7  bin/update_site.py
@@ -29,8 +29,8 @@
29 29
     'prod':  ['prod',   'master'],
30 30
 }
31 31
 
32  
-# The URL of the SVN repository with the localization files (*.po). If you set 
33  
-# it to a non-empty value, remember to `git rm --cached -r locale` in the root 
  32
+# The URL of the SVN repository with the localization files (*.po). If you set
  33
+# it to a non-empty value, remember to `git rm --cached -r locale` in the root
34 34
 # of the project.  Example:
35 35
 # LOCALE_REPO_URL = 'https://svn.mozilla.org/projects/l10n-misc/trunk/playdoh/locale'
36 36
 LOCALE_REPO_URL = ''
@@ -89,7 +89,8 @@ def update_site(env, debug):
89 89
         (CHDIR, os.path.join(here)),
90 90
         (EXEC, 'python2.6 vendor/src/schematic/schematic migrations/'),
91 91
         (EXEC, 'python2.6 manage.py collectstatic --noinput'),
92  
-        (EXEC, 'python2.6 manage.py compress_assets'),
  92
+        # un-comment if you haven't moved to django-compressor yet
  93
+        #(EXEC, 'python2.6 manage.py compress_assets'),
93 94
     ]
94 95
 
95 96
     for cmd, cmd_args in commands:
5  project/base/templates/example_base.html
@@ -5,7 +5,9 @@
5 5
     <title>{% block page_title %}playdoh examples{% endblock %}</title>
6 6
 
7 7
     {% block site_css %}
8  
-      {{ css('example_css') }}
  8
+      {% compress css %}
  9
+      <link href="{{ static('examples/css/main.css') }}" rel="stylesheet">
  10
+      {% endcompress %}
9 11
     {% endblock %}
10 12
   </head>
11 13
   <body data-mobile-cookie="{{ settings.MOBILE_COOKIE }}">
@@ -23,4 +25,3 @@
23 25
     {% endblock %}
24 26
   </body>
25 27
 </html>
26  
-
0  media/css/examples/main.css → project/examples/static/examples/css/main.css
File renamed without changes
0  media/css/examples/mobile.css → project/examples/static/examples/css/mobile.css
File renamed without changes
0  media/js/examples/init.js → project/examples/static/examples/js/init.js
File renamed without changes
0  media/js/examples/libs/jquery-1.4.4.min.js → ...mples/static/examples/js/libs/jquery-1.4.4.min.js
File renamed without changes
0  media/js/examples/libs/jquery.cookie.js → ...examples/static/examples/js/libs/jquery.cookie.js
File renamed without changes
6  project/examples/templates/examples/home.html
@@ -40,7 +40,11 @@
40 40
 </ul>
41 41
 {% endblock %}
42 42
 {% block site_js %}
43  
-    {{ js('example_js') }}
  43
+    {% compress js %}
  44
+    <script src="{{ static('examples/js/libs/jquery-1.4.4.min.js') }}"></script>
  45
+    <script src="{{ static('examples/js/libs/jquery.cookie.js') }}"></script>
  46
+    <script src="{{ static('examples/js/init.js') }}"></script>
  47
+    {% endcompress %}
44 48
     {% if not request.user.is_active %}
45 49
         {{ browserid_form.media }}
46 50
     {% endif %}
4  project/examples/templates/examples/mobile/home.html
... ...
@@ -1,5 +1,7 @@
1 1
 {% extends "examples/home.html" %}
2 2
 
3 3
 {% block site_css %}
4  
-  {{ css('example_mobile_css') }}
  4
+  {% compress css %}
  5
+    <link href="{{ static('examples/css/mobile.css') }}" rel="stylesheet">
  6
+  {% endcompress %}
5 7
 {% endblock %}
20  project/settings/base.py
@@ -9,26 +9,6 @@
9 9
 # clone.
10 10
 PROJECT_MODULE = 'project'
11 11
 
12  
-# Bundles is a dictionary of two dictionaries, css and js, which list css files
13  
-# and js files that can be bundled together by the minify app.
14  
-MINIFY_BUNDLES = {
15  
-    'css': {
16  
-        'example_css': (
17  
-            'css/examples/main.css',
18  
-        ),
19  
-        'example_mobile_css': (
20  
-            'css/examples/mobile.css',
21  
-        ),
22  
-    },
23  
-    'js': {
24  
-        'example_js': (
25  
-            'js/examples/libs/jquery-1.4.4.min.js',
26  
-            'js/examples/libs/jquery.cookie.js',
27  
-            'js/examples/init.js',
28  
-        ),
29  
-    }
30  
-}
31  
-
32 12
 # Defines the views served for root URLs.
33 13
 ROOT_URLCONF = '%s.urls' % PROJECT_MODULE
34 14
 
8  project/urls.py
... ...
@@ -1,5 +1,6 @@
1 1
 from django.conf import settings
2 2
 from django.conf.urls.defaults import patterns, include
  3
+from django.contrib.staticfiles.urls import staticfiles_urlpatterns
3 4
 
4 5
 from .examples import urls
5 6
 
@@ -23,9 +24,4 @@
23 24
 
24 25
 ## In DEBUG mode, serve media files through Django.
25 26
 if settings.DEBUG:
26  
-    # Remove leading and trailing slashes so the regex matches.
27  
-    media_url = settings.MEDIA_URL.lstrip('/').rstrip('/')
28  
-    urlpatterns += patterns('',
29  
-        (r'^%s/(?P<path>.*)$' % media_url, 'django.views.static.serve',
30  
-         {'document_root': settings.MEDIA_ROOT}),
31  
-    )
  27
+    urlpatterns += staticfiles_urlpatterns()

0 notes on commit f525ab4

Please sign in to comment.
Something went wrong with that request. Please try again.