Browse files

half-ass attempt to make django-pipeline work

  • Loading branch information...
1 parent 2fbf537 commit ad2728994e2970c220a32050fd22eb248d0e5dca @dcramer dcramer committed Dec 5, 2012
Showing with 62 additions and 45 deletions.
  1. +53 −9 src/sentry/conf/server.py
  2. +9 −34 src/sentry/templates/sentry/layout.html
  3. +0 −2 src/sentry/web/frontend/generic.py
View
62 src/sentry/conf/server.py
@@ -142,7 +142,7 @@
'django.contrib.sites',
'django.contrib.staticfiles',
- 'compressor',
+ 'pipeline',
'crispy_forms',
'djcelery',
'gunicorn',
@@ -168,17 +168,61 @@
else:
LESS_BIN = 'lessc'
-# XXX: There is a bug in django-compressor that causes it to incorrectly handle
-# relative URLs in precompiled files (less) when compression is disabled
-COMPRESS_ENABLED = True
-COMPRESS_URL = STATIC_URL
-COMPRESS_OUTPUT_DIR = 'CACHE'
-COMPRESS_PRECOMPILERS = (
- ('text/less', '%s --strict-imports {infile} {outfile}' % (LESS_BIN,)),
+PIPELINE = False
+PIPELINE_CSS = {
+ 'lib': {
+ 'source_filenames': (
+ 'scripts/lib/select2/select2.css',
+ ),
+ 'output_filename': 'styles/vendor.css',
+ },
+ 'sentry': {
+ 'source_filenames': (
+ 'less/sentry.less',
+ ),
+ 'output_filename': 'styles/sentry.css',
+ },
+}
+
+PIPELINE_JS = {
+ 'vendor': {
+ 'source_filenames': (
+ 'scripts/lib/jquery.js',
+ 'scripts/lib/jquery.animate-colors-min.js',
+ 'scripts/lib/jquery.clippy.min.js',
+ 'scripts/lib/jquery.cookie.js',
+ 'scripts/lib/jquery.flot.min.js',
+ 'scripts/lib/json2.js',
+ 'scripts/lib/underscore.js',
+ 'scripts/lib/backbone.js',
+ 'scripts/lib/select2/select2.js',
+ 'scripts/lib/bootstrap.js',
+ ),
+ 'output_filename': 'scripts/vendor.js',
+ },
+ 'sentry': {
+ 'source_filenames': (
+ 'scripts/core.js',
+ 'scripts/models.js',
+ 'scripts/templates.js',
+ 'scripts/utils.js',
+ 'scripts/collections.js',
+ 'scripts/views.js',
+ 'scripts/app.js',
+ ),
+ 'output_filename': 'scripts/sentry.js',
+ }
+}
+
+PIPELINE_COMPILERS = (
+ 'pipeline.compilers.less.LessCompiler',
)
+PIPELINE_LESS_BINARY = LESS_BIN
+PIPELINE_LESS_ARGUMENTS = '--strict-imports'
+
+# STATICFILES_STORAGE = 'pipeline.storage.PipelineCachedStorage'
STATICFILES_FINDERS = (
- "compressor.finders.CompressorFinder",
"django.contrib.staticfiles.finders.FileSystemFinder",
"django.contrib.staticfiles.finders.AppDirectoriesFinder",
)
View
43 src/sentry/templates/sentry/layout.html
@@ -1,4 +1,4 @@
-{% load compress %}
+{% load compressed %}
{% load i18n %}
{% load sentry_helpers %}
@@ -11,10 +11,8 @@
<link href="{% url sentry-media "sentry" "images/favicon.png" %}" rel="shortcut icon" type="image/png"/>
{% block css %}
- {% compress css %}
- <link href="{% url sentry-media "sentry" "scripts/lib/select2/select2.css" %}" rel="stylesheet" type="text/css"/>
- <link href="{% url sentry-media "sentry" "less/sentry.less" %}" rel="stylesheet" type="text/less"/>
- {% endcompress %}
+ {% compressed_css 'vendor' %}
+ {% compressed_css 'sentry' %}
{% endblock %}
<title>{% block title %}Sentry{% endblock %}</title>
@@ -23,35 +21,14 @@
<script type="text/javascript" src="{% url sentry-media "sentry" "scripts/html5shiv.js" %}"></script>
<![endif]-->
{% block scripts %}
- {% compress js %}
- <script type="text/javascript" src="{% url sentry-media "sentry" "scripts/lib/jquery.js" %}"></script>
- <script type="text/javascript" src="{% url sentry-media "sentry" "scripts/lib/jquery.animate-colors-min.js" %}"></script>
- <script type="text/javascript" src="{% url sentry-media "sentry" "scripts/lib/jquery.clippy.min.js" %}"></script>
- <script type="text/javascript" src="{% url sentry-media "sentry" "scripts/lib/jquery.cookie.js" %}"></script>
- <script type="text/javascript" src="{% url sentry-media "sentry" "scripts/lib/jquery.flot.min.js" %}"></script>
- <script type="text/javascript" src="{% url sentry-media "sentry" "scripts/lib/json2.js" %}"></script>
- <script type="text/javascript" src="{% url sentry-media "sentry" "scripts/lib/underscore.js" %}"></script>
- <script type="text/javascript" src="{% url sentry-media "sentry" "scripts/lib/backbone.js" %}"></script>
- <script type="text/javascript" src="{% url sentry-media "sentry" "scripts/lib/select2/select2.js" %}"></script>
- <script type="text/javascript" src="{% url sentry-media "sentry" "scripts/lib/bootstrap.js" %}"></script>
- {% endcompress %}
- {% compress js %}
- <script type="text/javascript" src="{% url sentry-media "sentry" "scripts/core.js" %}"></script>
- <script type="text/javascript" src="{% url sentry-media "sentry" "scripts/models.js" %}"></script>
- <script type="text/javascript" src="{% url sentry-media "sentry" "scripts/templates.js" %}"></script>
- <script type="text/javascript" src="{% url sentry-media "sentry" "scripts/utils.js" %}"></script>
- <script type="text/javascript" src="{% url sentry-media "sentry" "scripts/collections.js" %}"></script>
- <script type="text/javascript" src="{% url sentry-media "sentry" "scripts/views.js" %}"></script>
- <script type="text/javascript" src="{% url sentry-media "sentry" "scripts/app.js" %}"></script>
- {% endcompress %}
+ {% compressed_js 'vendor' %}
+ {% compressed_js 'sentry' %}
{% comment %}
The sentry.* javascript is deprecated.
{% endcomment %}
- {% compress js %}
- <script type="text/javascript" src="{% url sentry-media "sentry" "scripts/sentry.core.js" %}"></script>
- <script type="text/javascript" src="{% url sentry-media "sentry" "scripts/sentry.charts.js" %}"></script>
- <script type="text/javascript" src="{% url sentry-media "sentry" "scripts/sentry.stream.js" %}"></script>
- {% endcompress %}
+ <script type="text/javascript" src="{% url sentry-media "sentry" "scripts/sentry.core.js" %}"></script>
+ <script type="text/javascript" src="{% url sentry-media "sentry" "scripts/sentry.charts.js" %}"></script>
+ <script type="text/javascript" src="{% url sentry-media "sentry" "scripts/sentry.stream.js" %}"></script>
<script type="text/javascript">
Sentry.config({
urlPrefix: {{ URL_PREFIX|to_json|safe }},
@@ -71,9 +48,7 @@
{% endblock %}
{% if USE_JS_CLIENT and INTERNAL_PROJECT %}
- {% compress js %}
- <script type="text/javascript" src="{% url sentry-media "sentry" "scripts/lib/raven.js" %}"></script>
- {% endcompress %}
+ <script type="text/javascript" src="{% url sentry-media "sentry" "scripts/lib/raven.js" %}"></script>
<script type="text/javascript">
Raven.config({{ INTERNAL_PROJECT.dsn|to_json|safe }});
window.onerror = Raven.process;
View
2 src/sentry/web/frontend/generic.py
@@ -54,8 +54,6 @@ def static_media(request, module, path, root=None):
document_root = root
elif module == 'sentry':
document_root = os.path.join(settings.MODULE_ROOT, 'static', module)
- elif module == dj_settings.COMPRESS_OUTPUT_DIR:
- document_root = os.path.join(dj_settings.STATIC_ROOT, module)
elif module not in dj_settings.INSTALLED_APPS:
raise Http404('Invalid module provided.')
else:

0 comments on commit ad27289

Please sign in to comment.