Django Compress setup
来源:互联网 发布:淘宝直通车养词要多久? 编辑:程序博客网 时间:2024/05/23 12:58
1. Install Django-Compress
For windows:
a. pipinstall wheel==0.29.0
b.pipinstall rcssmin==1.0.6 --install-option="--without-c-extensions"
c.pipinstall rjsmin==1.0.12 --install-option="--without-c-extensions"
d.pipinstall django_compressor==2.0
For Linux:
a.pipinstall django_compressor==2.0
2.Enable Feature
settings.py
a. append 'compressor.finders.CompressorFinder' to STATICFILES_FINDERSb. COMPRESS_ENABLED=True (If DEBUG=True, need explicit declaration)
c.COMPRESS_OFFLINE=True (如果希望离线压缩文件,需要手动打开设置)
d.append template variable to COMPRESS_OFFLINE_CONTEXT (因为compress所包含的模板片段可能会有变量,需要显示指定)
eg:
COMPRESS_OFFLINE_CONTEXT = {
'URL_PREFIX': URL_PREFIX,
'STATIC_URL': STATIC_URL
}
3.Use Compress
a.{% load compress %}
b.{% compress css %}{% endcompress %} ( generate .css )
c.{% compress js %}{% endcompress %} ( generate .js )
4.Relative URL
http://django-compressor.readthedocs.io/en/latest/usage/
http://stackoverflow.com/questions/9559018/does-django-compressor-work-with-template-inheritance
- Django Compress setup
- setup django 4 test
- vagrant setup django vm
- compress
- compress
- compress
- Ubuntu 14.04 + Apache2 + Django setup
- How to setup Apache + Python + Django + mod_wsgi
- A Django setup using Nginx and Gunicorn
- Setup E-mail test environment for Pinax(django)
- How to setup django, python environment in ubuntu
- How to setup Apache and mod_python and django
- Django from setuptools import setup, find_packages 的问题
- HOWTO django + celery + rabbitmq simple setup for testing purpose
- setup
- setup
- Setup
- setup
- wpa配置
- UVA - 1588 Kickdown
- UVA - 1368 DNA Consensus String
- UVA - 1586 Molar Mass
- tcp/ip,http,socket mysql底层技术原理
- Django Compress setup
- android 反编译
- UVA - 10361 Automatic Poetry
- Source Insight 常用设置和快捷键大全
- 升级款E4418CORE-V1C 最强最小工业级核心模块 横空出世
- ASP.NET-----验证控件
- 代理模式
- JAVA中线程池的整理
- UVA - 401 Palindromes