mirror of
https://github.com/zulip/zulip.git
synced 2025-11-01 04:23:46 +00:00
Upgrade to Django-Pipeline==1.6.8.
This commit is contained in:
@@ -139,3 +139,6 @@ uritemplate==0.6
|
||||
zope.interface==4.1.2
|
||||
|
||||
-r emailmirror.txt
|
||||
|
||||
# Django extension for static asset pipeline
|
||||
django-pipeline==1.6.8
|
||||
|
||||
@@ -2,9 +2,6 @@
|
||||
|
||||
enum34==1.0.4
|
||||
|
||||
# Django extension for static asset pipeline
|
||||
django-pipeline==1.2.2
|
||||
|
||||
# Used for Hesiod lookups, etc.
|
||||
pydns==2.3.6
|
||||
|
||||
|
||||
@@ -3,9 +3,6 @@
|
||||
# Used for Hesiod lookups, etc.
|
||||
py3dns==3.1.0
|
||||
|
||||
# Django extension for static asset pipeline
|
||||
django-pipeline==1.6.8
|
||||
|
||||
# Needed for LDAP integration
|
||||
pyldap==2.4.25.1
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
{% block customhead %}
|
||||
{{ super() }}
|
||||
{{ minified_js('activity')|safe }}
|
||||
{{ compressed_css('activity')|safe }}
|
||||
{% stylesheet 'activity' %}
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
{% endif %}
|
||||
|
||||
{# We need to import jQuery before Bootstrap #}
|
||||
{{ compressed_css('common')|safe }}
|
||||
{% stylesheet 'common' %}
|
||||
{% block page_params %}
|
||||
{# blueslip needs page_params.debug_mode. Set it to false by default. #}
|
||||
<script type="text/javascript">
|
||||
|
||||
@@ -31,9 +31,9 @@ var page_params = {{ page_params }};
|
||||
|
||||
{% if nofontface %}
|
||||
{# We can't use @font-face on qtwebkit, so use differently minified CSS #}
|
||||
{{ compressed_css('app-fontcompat')|safe }}
|
||||
{% stylesheet 'app-fontcompat' %}
|
||||
{% else %}
|
||||
{{ compressed_css('app')|safe }}
|
||||
{% stylesheet 'app' %}
|
||||
{% endif %}
|
||||
{{ minified_js('app')|safe }}
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
#}
|
||||
|
||||
{% block customhead %}
|
||||
{{ compressed_css('portico')|safe }}
|
||||
{% stylesheet 'portico' %}
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
|
||||
@@ -1026,7 +1026,7 @@ def home(request):
|
||||
'avatar_url': avatar_url(user_profile),
|
||||
'show_debug':
|
||||
settings.DEBUG and ('show_debug' in request.GET),
|
||||
'pipeline': settings.PIPELINE,
|
||||
'pipeline': settings.PIPELINE_ENABLED,
|
||||
'show_invites': show_invites,
|
||||
'is_admin': user_profile.is_realm_admin,
|
||||
'show_webathena': user_profile.realm.domain == "mit.edu",
|
||||
|
||||
@@ -4,7 +4,7 @@ import os.path
|
||||
|
||||
# These URLs are available only in the development environment
|
||||
|
||||
use_prod_static = getattr(settings, 'PIPELINE', False)
|
||||
use_prod_static = getattr(settings, 'PIPELINE_ENABLED', False)
|
||||
static_root = os.path.join(settings.DEPLOY_ROOT, 'prod-static/serve' if use_prod_static else 'static')
|
||||
|
||||
urls = [url(r'^static/(?P<path>.*)$', 'django.views.static.serve', {'document_root': static_root})]
|
||||
|
||||
@@ -8,7 +8,7 @@ from django.utils import translation
|
||||
from django.http import HttpResponse
|
||||
from jinja2 import Environment
|
||||
|
||||
from .compressors import compressed_css, minified_js
|
||||
from .compressors import minified_js
|
||||
from zerver.templatetags.app_filters import display_list
|
||||
|
||||
|
||||
@@ -22,7 +22,6 @@ def environment(**options):
|
||||
env.globals.update({
|
||||
'static': staticfiles_storage.url,
|
||||
'url': reverse,
|
||||
'compressed_css': compressed_css,
|
||||
'minified_js': minified_js,
|
||||
})
|
||||
|
||||
|
||||
@@ -5,15 +5,10 @@ from __future__ import absolute_import # Python 2 only
|
||||
|
||||
from django.conf import settings
|
||||
from django.template import TemplateSyntaxError
|
||||
from pipeline.templatetags.compressed import CompressedCSSNode
|
||||
|
||||
from zerver.templatetags.minified_js import MinifiedJSNode
|
||||
|
||||
|
||||
def compressed_css(package_name):
|
||||
return CompressedCSSNode(package_name).render({package_name: package_name})
|
||||
|
||||
|
||||
def minified_js(sourcefile):
|
||||
if sourcefile not in settings.JS_SPECS:
|
||||
raise TemplateSyntaxError(
|
||||
|
||||
@@ -236,13 +236,14 @@ TEMPLATES = [
|
||||
'DIRS': [
|
||||
os.path.join(DEPLOY_ROOT, 'templates'),
|
||||
],
|
||||
'APP_DIRS': False,
|
||||
'APP_DIRS': True,
|
||||
'OPTIONS': {
|
||||
'debug': DEBUG,
|
||||
'environment': 'zproject.jinja2.environment',
|
||||
'extensions': [
|
||||
'jinja2.ext.i18n',
|
||||
'jinja2.ext.autoescape',
|
||||
'pipeline.jinja2.PipelineExtension',
|
||||
],
|
||||
'context_processors': [
|
||||
'zerver.context_processors.add_settings',
|
||||
@@ -531,14 +532,15 @@ STATIC_URL = '/static/'
|
||||
|
||||
# This is the default behavior from Pipeline, but we set it
|
||||
# here so that urls.py can read it.
|
||||
PIPELINE = not DEBUG
|
||||
PIPELINE_ENABLED = not DEBUG
|
||||
|
||||
if DEBUG:
|
||||
STATICFILES_STORAGE = 'pipeline.storage.PipelineStorage'
|
||||
STATICFILES_FINDERS = (
|
||||
'django.contrib.staticfiles.finders.AppDirectoriesFinder',
|
||||
'pipeline.finders.PipelineFinder',
|
||||
)
|
||||
if PIPELINE:
|
||||
if PIPELINE_ENABLED:
|
||||
STATIC_ROOT = os.path.abspath('prod-static/serve')
|
||||
else:
|
||||
STATIC_ROOT = os.path.abspath('static/')
|
||||
@@ -558,13 +560,17 @@ FILE_UPLOAD_MAX_MEMORY_SIZE = 0
|
||||
STATICFILES_DIRS = ['static/']
|
||||
STATIC_HEADER_FILE = 'zerver/static_header.txt'
|
||||
|
||||
# To use minified files in dev, set PIPELINE = True. For the full
|
||||
# To use minified files in dev, set PIPELINE_ENABLED = True. For the full
|
||||
# cache-busting behavior, you must also set DEBUG = False.
|
||||
#
|
||||
# You will need to run update-prod-static after changing
|
||||
# static files.
|
||||
|
||||
PIPELINE_CSS = {
|
||||
PIPELINE = {
|
||||
'PIPELINE_ENABLED': PIPELINE_ENABLED,
|
||||
'CSS_COMPRESSOR': 'pipeline.compressors.yui.YUICompressor',
|
||||
'YUI_BINARY': '/usr/bin/env yui-compressor',
|
||||
'STYLESHEETS': {
|
||||
'activity': {
|
||||
'source_filenames': ('styles/activity.css',),
|
||||
'output_filename': 'min/activity.css'
|
||||
@@ -613,6 +619,8 @@ PIPELINE_CSS = {
|
||||
),
|
||||
'output_filename': 'min/common.css'
|
||||
},
|
||||
},
|
||||
'JAVASCRIPT': {},
|
||||
}
|
||||
|
||||
JS_SPECS = {
|
||||
@@ -738,7 +746,7 @@ JS_SPECS = {
|
||||
'js/referral.js',
|
||||
'js/custom_markdown.js',
|
||||
'js/bot_data.js',
|
||||
# JS bundled by webpack is also included here if PIPELINE setting is true
|
||||
# JS bundled by webpack is also included here if PIPELINE_ENABLED setting is true
|
||||
],
|
||||
'output_filename': 'min/app.js'
|
||||
},
|
||||
@@ -755,18 +763,12 @@ JS_SPECS = {
|
||||
},
|
||||
}
|
||||
|
||||
if PIPELINE:
|
||||
if PIPELINE_ENABLED:
|
||||
# This is also done in test_settings.py, see comment there..
|
||||
JS_SPECS['app']['source_filenames'].append('js/bundle.js')
|
||||
|
||||
app_srcs = JS_SPECS['app']['source_filenames']
|
||||
|
||||
PIPELINE_JS = {} # Now handled in tools/minify-js
|
||||
PIPELINE_JS_COMPRESSOR = None
|
||||
|
||||
PIPELINE_CSS_COMPRESSOR = 'pipeline.compressors.yui.YUICompressor'
|
||||
PIPELINE_YUI_BINARY = '/usr/bin/env yui-compressor'
|
||||
|
||||
########################################################################
|
||||
# LOGGING SETTINGS
|
||||
########################################################################
|
||||
|
||||
@@ -12,7 +12,7 @@ DATABASES["default"] = {"NAME": "zulip_test",
|
||||
"OPTIONS": {"connection_factory": TimeTrackingConnection },}
|
||||
|
||||
# In theory this should just go in zproject/settings.py inside the `if
|
||||
# PIPELINE` statement, but because zproject/settings.py is processed
|
||||
# PIPELINE_ENABLED` statement, but because zproject/settings.py is processed
|
||||
# first, we have to add it here as a hack.
|
||||
JS_SPECS['app']['source_filenames'].append('js/bundle.js')
|
||||
|
||||
|
||||
Reference in New Issue
Block a user